SlideShare una empresa de Scribd logo
1 de 18
Descargar para leer sin conexión
Linux on Spartan
COMP90024 Cluster and Cloud Computing
University of Melbourne, 21st
March 2023
lev.lafayette@unimelb.edu.au
Prerequisites and CLI Reasons
An account on Spartan and membership to a project is
required.
An SSH (secure shell client) is required. This is typically
already installed on Mac and Linux systems. For MS-
Windows putty or mobaxterm are options.
The command line interface (CLI) is “close to the metal”, and
resource efficient. It is also powerful and, with scripting, frees
up time and effort for the user.
Knowing the Linux CLI is essential for any serious
researcher!
SSH and Logging In
Access the logon node with SSH command; e.g.,
ssh lev@spartan.hpc.unimelb.edu.au
Process can be improved with SSH configuration files and
“passwordless SSH” that uses key-exchange for
authentication. Agent-forwarding provides additional
convenience.
https://dashboard.hpc.unimelb.edu.au/ssh/
File System and Environment
"Everything in the UNIX system is a file" (Kernighan & Pike,
1984, 41).
Login will take the user to /home/$USERID
https://swcarpentry.github.io/shell-novice/fig/standard-
filesystem-hierarchy.svg
Core environment commands;
whoami : print user id
pwd : print working directory
ls : List the directory contents
date : print system date and time
Shell Shortcuts
~ Home directory
. Current working directory
.. One directory level closer to root
/ root directory, directory delimiter
^r Traverse command history or use navigation keys
^L Clear the screen; equivalent of the “clear” command.
Tab completion provides navigation and command options
e.g.,
$ ls /usr/local/common/Int
Interact/ IntroLinux/
Command Options and Manual
Commands are modular and robust and come with a default
execution. Alternative execution is invoked with options;
<command> -<abbreviation> or <command> --<full-word>
For example:
ls -lart : Directory listing, all files, reverse time of modification
ls -lash : Directory listing, all files, size is in human format
Hundreds of commands, thousands of options! Fortunately,
there is a manual :)
man ls or info ls : Summary of “ls” command and options.
whatis ls : Short description.
man -k compiler or apropos compiler : Search man pages.
man man: The manual page for manual pages.
Pipes and Redirects
The pipe is typically used to redirect the output of one
command as the input to another for further processing.
Multiple commands can be piped in sequence to develop
some very specific outcomes.
who -u | less : List of users logged in, piped to less (viewer)
who | wc -l : Count lines of users logged in
Output and input can redirected to/from a file rather than
standard output or standard input. Output redirects can be
appended.
w > list.txt : Redirect to list.txt
w >> list.txt : Redirect and append to list.txt
Files and Text Editing
Filenames can include any characters except the forward
slash (directory delimiter) or null. A good habit to avoid non-
printing characters (e.g., spaces)! Consider using
snake_case, kebab-case, or CamelCase, instead.
The “touch” command creates a file with no content e.g.,
touch LIST.TXT
Filenames are case sensitive; list.txt, LIST.TXT are different.
File types can be determined by the file command (e.g., file
list.txt).
Three main text editors available; nano (easy), emacs
(feature-rich), and vim (powerful).
Local Copying
To copy files from a remote system to a local system one can
use tools like wget, git, cURL, scp, or rsync. For example:
wget https://swcarpentry.github.io/shell-novice/fig/standard-
filesystem-hierarchy.svg
wget -r --no-parent https://swcarpentry.github.io/shell-novice/
To copy files and directories within a system use the cp
command. Common options include -r (recursive), -a (archive
permissions), -u (update, copy only if source is newer).
cp /usr/local/common/IntroLinux/gattaca.txt .
cp -r /usr/local/common/IntroLinux
Remote Copying
To copy files between systems use scp/stfp or rsync. GUI
clients are available (e.g., Filezilla). Again, passwordless
SSH and SSH client files are useful!
scp lev@spartan.hpc.unimelb.edu.au:gattaca.txt .
scp -r lev@spartan.hpc.unimelb.edu.au:IntroLinux .
The rsync utility provides a fast way to keep two collections of
files "in sync" by tracking changes. This example keeps
permissions (-a), is verbose (-v), compresses between
source and destination (-z), and only syncs if the source is
newer (--update)
rsync -avz --update workfiles/
lev@spartan.hpc.unimelb.edu.au:files/workfiles
Remote Copying
To copy files between systems use scp/stfp or rsync. GUI
clients are available (e.g., Filezilla). Again, passwordless
SSH and SSH client files are useful!
scp lev@spartan.hpc.unimelb.edu.au:gattaca.txt .
scp -r lev@spartan.hpc.unimelb.edu.au:IntroLinux .
The rsync utility provides a fast way to keep two collections of
files "in sync" by tracking changes. This example keeps
permissions (-a), is verbose (-v), compresses between
source and destination (-z), and only syncs if the source is
newer (--update)
rsync -avz --update workfiles/
lev@spartan.hpc.unimelb.edu.au:files/workfiles
Creating Directories, Moving Files
Directories can be created with the mkdir (make directory)
command. Multiple directories can be created at the same
time with space delimiting the separate directories.
The mv (move) command will move (and rename) a file.
There are options for -f (force), -i (interactive), and -n (no
clobber). If more than one of these is selected only the last
one is applied.
Example:
mkdir BRAF
nano gattaca.txt (make a single character change)
mv gattaca.txt BRAF/
scp -r BRAF lev@spartan.hpc.unimelb.edu.au:
File Differences
The -l option is ls gives a timestamp for modification.
Differences in content can be determined by the diff
command. Or, with a side-by-side representation with sdiff.
Further, there is the comm command, which compares two
files sorted line by line.
ls -l gattaca.txt BRAF/gattaca.txt
diff gattaca.txt BRAF/gattaca.txt
sdiff gattaca.txt BRAF/gattaca.txt
comm gattaca.txt BRAF/gattaca.txt
Note that the diff command also gives the sequence of
commands for the very old UNIX editor, ed. This is still used
for invoking patch files!
File Searches, Globbing
On many Linux systems one can use the locate command to
find files; but often disabled a large shared system like
Spartan!
Instead, use the “find” command; very powerful, many
options. The following examples also use wildcards (*, all
files and ?, single character) and ranges.
find . -name "*.log"
find . -name "comsol?.log"
find . -name "comsol[1-3].log"
The term “glob” is short for “global” in the UNIX function
glob().
Searches Within Files
Searching within a file for a string of text is achieved with
grep (“global search for regular expression and print”). Often
used with “strong” quotes to protect from command
substitution or variables.
The following command is grep, with the option -i for "case-
insensitive", followed by the regular expression 'ATEK'.
grep -i 'ATEK' BRAF/*
touch braf/file1
grep -i 'ATEK' BRAF/*
Deletions
Deleting files actually means deleting files on the CLI! There
is no "trashcan" or "recycle bin" or anything like that.
Files can be deleted with the "rm" (remove) command. Empty
directories can be deleted with "rmdir" (remove directory),
however the directory must be empty.
A very powerful shortcut is rm -rf (remove, recursive, force).
rm gattaca.txt
rmdir braf/
rm -rf braf/
Think before running rm -rf – and then think again!
This Matters
BRAF is a human gene that makes a protein (imaginatively)
named B-Raf. This protein is involved in sending signals
inside cells, which are involved in directing cell growth.
In 2002, it was shown to be faulty (mutated) in human
cancers. In particular, the difference between the two files
"ATVKSRWSGS" and "ATEKSRWSGS" is the difference that
leads to susceptibility to metastatic melanoma.
2023comp90024_linux.pdf

Más contenido relacionado

Similar a 2023comp90024_linux.pdf

Introduction to-linux
Introduction to-linuxIntroduction to-linux
Introduction to-linuxrowiebornia
 
Introduction-to-Linux.pptx
Introduction-to-Linux.pptxIntroduction-to-Linux.pptx
Introduction-to-Linux.pptxDavidMaina47
 
Introduction khgjkhygkjiyhgikjyhgikygkii
Introduction khgjkhygkjiyhgikjyhgikygkiiIntroduction khgjkhygkjiyhgikjyhgikygkii
Introduction khgjkhygkjiyhgikjyhgikygkiicmdept1
 
Linuxppt
LinuxpptLinuxppt
LinuxpptReka
 
Linux Cheat Sheet.pdf
Linux Cheat Sheet.pdfLinux Cheat Sheet.pdf
Linux Cheat Sheet.pdfroschahacker
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptxHarsha Patel
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptxHarsha Patel
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08Tushar Jain
 
Linux file commands and shell scripts
Linux file commands and shell scriptsLinux file commands and shell scripts
Linux file commands and shell scriptsPrashantTechment
 
Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Vu Hung Nguyen
 
2023comp90024_linux2.pdf
2023comp90024_linux2.pdf2023comp90024_linux2.pdf
2023comp90024_linux2.pdfLevLafayette1
 
Unix Basics 04sp
Unix Basics 04spUnix Basics 04sp
Unix Basics 04spDr.Ravi
 
intro unix/linux 02
intro unix/linux 02intro unix/linux 02
intro unix/linux 02duquoi
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix ConceptsChapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix ConceptsMeenalJabde
 
Unit 1-a-brief-history-of-unix-ppt
Unit 1-a-brief-history-of-unix-pptUnit 1-a-brief-history-of-unix-ppt
Unit 1-a-brief-history-of-unix-pptRahul Mashal
 

Similar a 2023comp90024_linux.pdf (20)

Introduction to-linux
Introduction to-linuxIntroduction to-linux
Introduction to-linux
 
Introduction-to-Linux.pptx
Introduction-to-Linux.pptxIntroduction-to-Linux.pptx
Introduction-to-Linux.pptx
 
Introduction khgjkhygkjiyhgikjyhgikygkii
Introduction khgjkhygkjiyhgikjyhgikygkiiIntroduction khgjkhygkjiyhgikjyhgikygkii
Introduction khgjkhygkjiyhgikjyhgikygkii
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
 
Linux Cheat Sheet.pdf
Linux Cheat Sheet.pdfLinux Cheat Sheet.pdf
Linux Cheat Sheet.pdf
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptx
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptx
 
Linux
LinuxLinux
Linux
 
Linux Workshop , Day 3
Linux Workshop , Day 3Linux Workshop , Day 3
Linux Workshop , Day 3
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
 
Linux file commands and shell scripts
Linux file commands and shell scriptsLinux file commands and shell scripts
Linux file commands and shell scripts
 
Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools
 
2023comp90024_linux2.pdf
2023comp90024_linux2.pdf2023comp90024_linux2.pdf
2023comp90024_linux2.pdf
 
Unix Basics 04sp
Unix Basics 04spUnix Basics 04sp
Unix Basics 04sp
 
cisco
ciscocisco
cisco
 
intro unix/linux 02
intro unix/linux 02intro unix/linux 02
intro unix/linux 02
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix ConceptsChapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix Concepts
 
3. intro
3. intro3. intro
3. intro
 
Unit 1-a-brief-history-of-unix-ppt
Unit 1-a-brief-history-of-unix-pptUnit 1-a-brief-history-of-unix-ppt
Unit 1-a-brief-history-of-unix-ppt
 

Último

CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 

Último (20)

CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 

2023comp90024_linux.pdf

  • 1. Linux on Spartan COMP90024 Cluster and Cloud Computing University of Melbourne, 21st March 2023 lev.lafayette@unimelb.edu.au
  • 2. Prerequisites and CLI Reasons An account on Spartan and membership to a project is required. An SSH (secure shell client) is required. This is typically already installed on Mac and Linux systems. For MS- Windows putty or mobaxterm are options. The command line interface (CLI) is “close to the metal”, and resource efficient. It is also powerful and, with scripting, frees up time and effort for the user. Knowing the Linux CLI is essential for any serious researcher!
  • 3. SSH and Logging In Access the logon node with SSH command; e.g., ssh lev@spartan.hpc.unimelb.edu.au Process can be improved with SSH configuration files and “passwordless SSH” that uses key-exchange for authentication. Agent-forwarding provides additional convenience. https://dashboard.hpc.unimelb.edu.au/ssh/
  • 4. File System and Environment "Everything in the UNIX system is a file" (Kernighan & Pike, 1984, 41). Login will take the user to /home/$USERID https://swcarpentry.github.io/shell-novice/fig/standard- filesystem-hierarchy.svg Core environment commands; whoami : print user id pwd : print working directory ls : List the directory contents date : print system date and time
  • 5. Shell Shortcuts ~ Home directory . Current working directory .. One directory level closer to root / root directory, directory delimiter ^r Traverse command history or use navigation keys ^L Clear the screen; equivalent of the “clear” command. Tab completion provides navigation and command options e.g., $ ls /usr/local/common/Int Interact/ IntroLinux/
  • 6. Command Options and Manual Commands are modular and robust and come with a default execution. Alternative execution is invoked with options; <command> -<abbreviation> or <command> --<full-word> For example: ls -lart : Directory listing, all files, reverse time of modification ls -lash : Directory listing, all files, size is in human format Hundreds of commands, thousands of options! Fortunately, there is a manual :) man ls or info ls : Summary of “ls” command and options. whatis ls : Short description. man -k compiler or apropos compiler : Search man pages. man man: The manual page for manual pages.
  • 7. Pipes and Redirects The pipe is typically used to redirect the output of one command as the input to another for further processing. Multiple commands can be piped in sequence to develop some very specific outcomes. who -u | less : List of users logged in, piped to less (viewer) who | wc -l : Count lines of users logged in Output and input can redirected to/from a file rather than standard output or standard input. Output redirects can be appended. w > list.txt : Redirect to list.txt w >> list.txt : Redirect and append to list.txt
  • 8. Files and Text Editing Filenames can include any characters except the forward slash (directory delimiter) or null. A good habit to avoid non- printing characters (e.g., spaces)! Consider using snake_case, kebab-case, or CamelCase, instead. The “touch” command creates a file with no content e.g., touch LIST.TXT Filenames are case sensitive; list.txt, LIST.TXT are different. File types can be determined by the file command (e.g., file list.txt). Three main text editors available; nano (easy), emacs (feature-rich), and vim (powerful).
  • 9. Local Copying To copy files from a remote system to a local system one can use tools like wget, git, cURL, scp, or rsync. For example: wget https://swcarpentry.github.io/shell-novice/fig/standard- filesystem-hierarchy.svg wget -r --no-parent https://swcarpentry.github.io/shell-novice/ To copy files and directories within a system use the cp command. Common options include -r (recursive), -a (archive permissions), -u (update, copy only if source is newer). cp /usr/local/common/IntroLinux/gattaca.txt . cp -r /usr/local/common/IntroLinux
  • 10. Remote Copying To copy files between systems use scp/stfp or rsync. GUI clients are available (e.g., Filezilla). Again, passwordless SSH and SSH client files are useful! scp lev@spartan.hpc.unimelb.edu.au:gattaca.txt . scp -r lev@spartan.hpc.unimelb.edu.au:IntroLinux . The rsync utility provides a fast way to keep two collections of files "in sync" by tracking changes. This example keeps permissions (-a), is verbose (-v), compresses between source and destination (-z), and only syncs if the source is newer (--update) rsync -avz --update workfiles/ lev@spartan.hpc.unimelb.edu.au:files/workfiles
  • 11. Remote Copying To copy files between systems use scp/stfp or rsync. GUI clients are available (e.g., Filezilla). Again, passwordless SSH and SSH client files are useful! scp lev@spartan.hpc.unimelb.edu.au:gattaca.txt . scp -r lev@spartan.hpc.unimelb.edu.au:IntroLinux . The rsync utility provides a fast way to keep two collections of files "in sync" by tracking changes. This example keeps permissions (-a), is verbose (-v), compresses between source and destination (-z), and only syncs if the source is newer (--update) rsync -avz --update workfiles/ lev@spartan.hpc.unimelb.edu.au:files/workfiles
  • 12. Creating Directories, Moving Files Directories can be created with the mkdir (make directory) command. Multiple directories can be created at the same time with space delimiting the separate directories. The mv (move) command will move (and rename) a file. There are options for -f (force), -i (interactive), and -n (no clobber). If more than one of these is selected only the last one is applied. Example: mkdir BRAF nano gattaca.txt (make a single character change) mv gattaca.txt BRAF/ scp -r BRAF lev@spartan.hpc.unimelb.edu.au:
  • 13. File Differences The -l option is ls gives a timestamp for modification. Differences in content can be determined by the diff command. Or, with a side-by-side representation with sdiff. Further, there is the comm command, which compares two files sorted line by line. ls -l gattaca.txt BRAF/gattaca.txt diff gattaca.txt BRAF/gattaca.txt sdiff gattaca.txt BRAF/gattaca.txt comm gattaca.txt BRAF/gattaca.txt Note that the diff command also gives the sequence of commands for the very old UNIX editor, ed. This is still used for invoking patch files!
  • 14. File Searches, Globbing On many Linux systems one can use the locate command to find files; but often disabled a large shared system like Spartan! Instead, use the “find” command; very powerful, many options. The following examples also use wildcards (*, all files and ?, single character) and ranges. find . -name "*.log" find . -name "comsol?.log" find . -name "comsol[1-3].log" The term “glob” is short for “global” in the UNIX function glob().
  • 15. Searches Within Files Searching within a file for a string of text is achieved with grep (“global search for regular expression and print”). Often used with “strong” quotes to protect from command substitution or variables. The following command is grep, with the option -i for "case- insensitive", followed by the regular expression 'ATEK'. grep -i 'ATEK' BRAF/* touch braf/file1 grep -i 'ATEK' BRAF/*
  • 16. Deletions Deleting files actually means deleting files on the CLI! There is no "trashcan" or "recycle bin" or anything like that. Files can be deleted with the "rm" (remove) command. Empty directories can be deleted with "rmdir" (remove directory), however the directory must be empty. A very powerful shortcut is rm -rf (remove, recursive, force). rm gattaca.txt rmdir braf/ rm -rf braf/ Think before running rm -rf – and then think again!
  • 17. This Matters BRAF is a human gene that makes a protein (imaginatively) named B-Raf. This protein is involved in sending signals inside cells, which are involved in directing cell growth. In 2002, it was shown to be faulty (mutated) in human cancers. In particular, the difference between the two files "ATVKSRWSGS" and "ATEKSRWSGS" is the difference that leads to susceptibility to metastatic melanoma.