SlideShare a Scribd company logo
Linux/Unix Command Line Cheat Sheet - GettingGeneticsDone.blogspot.com
Command Description
pwd prints working directory (prints to screen, ie displays the full path, or your location on the filesystem)
ls lists contents of current directory
ls –l lists contents of current directory with extra details
ls /home/user/*.txt lists all files in /home/user ending in .txt
cd change directory to your home directory
cd ~ change directory to your home directory
cd /scratch/user change directory to user on scratch
cd - change directory to the last directory you were in before changing to wherever you are now
mkdir mydir makes a directory called mydir
rmdir mydir removes directory called mydir. mydir must be empty
touch myfile creates a file called myfile. updates the timestamp on the file if it already exists, without modifying its contents
cp myfile myfile2 copies myfile to myfile2. if myfile2 exists, this will overwrite it!
rm myfile removes file called myfile
rm –f myfile removes myfile without asking you for confirmation. useful if using wildcards to remove files ***
cp –r dir newdir copies the whole directory dir to newdir. –r must be specified to copy directory contents recursively
rm –rf mydir this will delete directory mydir along with all its content without asking you for confirmation! ***
nano opens a text editor. see ribbon at bottom for help. ^x means CTRL-x. this will exit nano
nano new.txt opens nano editing a file called new.txt
cat new.txt displays the contents of new.txt
more new.txt displays the contents of new.txt screen by screen. spacebar to pagedown, q to quit
head new.txt displays first 10 lines of new.txt
tail new.txt displays last 10 lines of new.txt
tail –f new.txt displays the contents of a file as it grows, starting with the last 10 lines. ctrl-c to quit.
mv myfile newlocdir moves myfile into the destination directory newlocdir
mv myfile newname renames file to newname. if a file called newname exists, this will overwrite it!
mv dir subdir moves the directory called dir to the directory called subdir
mv dir newdirname renames directory dir to newdirname
top displays all the processes running on the machine, and shows available resources
du –h --max-depth=1 run this in your home directory to see how much space you are using. don’t exceed 5GB
ssh servername goes to a different server. this could be queso, brie, or provolone
grep pattern files searches for the pattern in files, and displays lines in those files matching the pattern
date shows the current date and time
anycommand > myfile redirects the output of anycommand writing it to a file called myfile
date > timestamp redirects the output of the date command to a file in the current directory called timestamp
anycommand >> myfile appends the output of anycommand to a file called myfile
date >> timestamp appends the current time and date to a file called timestamp. creates the file if it doesn’t exist
command1 | command2 “pipes” the output of command1 to command2. the pipe is usually shift-backslash key
date | grep Tue displays any line in the output of the date command that matches the pattern Tue. (is it Tuesday?)
tar -zxf archive.tgz this will extract the contents of the archive called archive.tgz. kind of like unzipping a zipfile. ***
tar -zcf dir.tgz dir this creates a compressed archive called dir.tgz that contains all the files and directory structure of dir
time anycommand runs anycommand, timing how long it takes, and displays that time to the screen after completing anycommand
man anycommand gives you help on anycommand
cal -y free calendar, courtesy unix
CTRL-c kills whatever process you’re currently doing
CTRL-insert copies selected text to the windows clipboard (n.b. see above, ctrl-c will kill whatever you’re doing)
SHIFT-insert pastes clipboard contents to terminal
*** = use with extreme caution! you can easily delete or overwrite important files with these.
Absolute vs relative paths.
Let’s say you are here: /home/turnersd/scripts/. If you wanted to go to /home/turnersd/, you could type: cd /home/turnersd/. Or you could
use a relative path. cd .. (two periods) will take you one directory “up” to the parent directory of the current directory.
. (a single period) means the current directory
.. (two periods) means the parent directory
~ means your home directory
A few examples
mv myfile .. moves myfile to the parent directory
cp myfile ../newname copies myfile to the parent directory and names the copy newname
cp /home/turnersd/scripts/bstrap.pl . copies bstrap.pl to “.” i.e. to dot, or the current directory you’re in
cp myfile ~/subdir/newname copies myfile to subdir in your home, naming the copy newname
more ../../../myfile displays screen by screen the content of myfile, which exists 3 directories “up”
Wildcards (use carefully, especially with rm)
* matches any character. example: ls *.pl lists any file ending with “.pl” ; rm dataset* will remove all files beginning with “dataset”
[xyz] matches any character in the brackets (x, y, or z). example: cat do[or]m.txt will display the contents of either doom.txt or dorm.txt

More Related Content

What's hot

User management
User managementUser management
User management
Mufaddal Haidermota
 
HCL Sametime 12.0 – Converting from native Domino Directory to LDAP and Migra...
HCL Sametime 12.0 – Converting from native Domino Directory to LDAP and Migra...HCL Sametime 12.0 – Converting from native Domino Directory to LDAP and Migra...
HCL Sametime 12.0 – Converting from native Domino Directory to LDAP and Migra...
Ales Lichtenberg
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
Sagar Kumar
 
Debian Linux Overview
Debian Linux OverviewDebian Linux Overview
Debian Linux Overview
DarshanRamjiyani
 
Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014
Noé Fernández-Pozo
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
Geeks Anonymes
 
Sudo`
Sudo`Sudo`
Linux presentation
Linux presentationLinux presentation
Linux presentationNikhil Jain
 
Lesson 2 Understanding Linux File System
Lesson 2 Understanding Linux File SystemLesson 2 Understanding Linux File System
Lesson 2 Understanding Linux File System
Sadia Bashir
 
Introduction 2 linux
Introduction 2 linuxIntroduction 2 linux
Introduction 2 linux
Papu Kumar
 
Users and groups in Linux
Users and groups in LinuxUsers and groups in Linux
Users and groups in Linux
Knoldus Inc.
 
Course 102: Lecture 4: Using Wild Cards
Course 102: Lecture 4: Using Wild CardsCourse 102: Lecture 4: Using Wild Cards
Course 102: Lecture 4: Using Wild Cards
Ahmed El-Arabawy
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
vceder
 
Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell ScriptingLinux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
Harish1983
 
Linux standard file system
Linux standard file systemLinux standard file system
Linux standard file system
Taaanu01
 
package mangement
package mangementpackage mangement
package mangement
ARYA TM
 
Intro to linux
Intro to linuxIntro to linux
Intro to linux
Vivek Kurmi
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
kalyanineve
 

What's hot (20)

User management
User managementUser management
User management
 
HCL Sametime 12.0 – Converting from native Domino Directory to LDAP and Migra...
HCL Sametime 12.0 – Converting from native Domino Directory to LDAP and Migra...HCL Sametime 12.0 – Converting from native Domino Directory to LDAP and Migra...
HCL Sametime 12.0 – Converting from native Domino Directory to LDAP and Migra...
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
Debian Linux Overview
Debian Linux OverviewDebian Linux Overview
Debian Linux Overview
 
Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014
 
Basic 50 linus command
Basic 50 linus commandBasic 50 linus command
Basic 50 linus command
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Sudo`
Sudo`Sudo`
Sudo`
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Lesson 2 Understanding Linux File System
Lesson 2 Understanding Linux File SystemLesson 2 Understanding Linux File System
Lesson 2 Understanding Linux File System
 
Introduction 2 linux
Introduction 2 linuxIntroduction 2 linux
Introduction 2 linux
 
Users and groups in Linux
Users and groups in LinuxUsers and groups in Linux
Users and groups in Linux
 
Course 102: Lecture 4: Using Wild Cards
Course 102: Lecture 4: Using Wild CardsCourse 102: Lecture 4: Using Wild Cards
Course 102: Lecture 4: Using Wild Cards
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
 
Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell ScriptingLinux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
Linux standard file system
Linux standard file systemLinux standard file system
Linux standard file system
 
package mangement
package mangementpackage mangement
package mangement
 
Intro to linux
Intro to linuxIntro to linux
Intro to linux
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
 

Similar to Linux cheat sheet

Linux_Commands.pdf
Linux_Commands.pdfLinux_Commands.pdf
Linux_Commands.pdf
MarsMox
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
Dheeraj Nambiar
 
Linux commands
Linux commandsLinux commands
Linux commandsU.P Police
 
Basic shell commands by Jeremy Sanders
Basic shell commands by Jeremy SandersBasic shell commands by Jeremy Sanders
Basic shell commands by Jeremy Sanders
Devanand Gehlot
 
LinuxLabBasics.ppt
LinuxLabBasics.pptLinuxLabBasics.ppt
LinuxLabBasics.ppt
CharuJain396881
 
unix_commands.ppt
unix_commands.pptunix_commands.ppt
unix_commands.ppt
SahilGandhi72
 
Internal commands of dos
Internal commands of dosInternal commands of dos
Internal commands of dos
Nargiskhan786
 
Directories description
Directories descriptionDirectories description
Directories description
Dr.M.Karthika parthasarathy
 
Linux Commands.pptx
Linux Commands.pptxLinux Commands.pptx
Linux Commands.pptx
MuhammadYasirKhan42
 
Linux Command.pptx
Linux Command.pptxLinux Command.pptx
Linux Command.pptx
SaileshB5
 
Unix3
Unix3Unix3
Examples -partII
Examples -partIIExamples -partII
Examples -partII
Kedar Bhandari
 
Basic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manualBasic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manual
Kuntal Bhowmick
 
linux-lecture4.ppt
linux-lecture4.pptlinux-lecture4.ppt
linux-lecture4.ppt
LuigysToro
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS
 
Rhel1
Rhel1Rhel1

Similar to Linux cheat sheet (20)

Linux_Commands.pdf
Linux_Commands.pdfLinux_Commands.pdf
Linux_Commands.pdf
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Basic shell commands by Jeremy Sanders
Basic shell commands by Jeremy SandersBasic shell commands by Jeremy Sanders
Basic shell commands by Jeremy Sanders
 
LinuxLabBasics.ppt
LinuxLabBasics.pptLinuxLabBasics.ppt
LinuxLabBasics.ppt
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
unix_commands.ppt
unix_commands.pptunix_commands.ppt
unix_commands.ppt
 
Internal commands of dos
Internal commands of dosInternal commands of dos
Internal commands of dos
 
Directories description
Directories descriptionDirectories description
Directories description
 
Linux Commands.pptx
Linux Commands.pptxLinux Commands.pptx
Linux Commands.pptx
 
Linux Command.pptx
Linux Command.pptxLinux Command.pptx
Linux Command.pptx
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
Unix3
Unix3Unix3
Unix3
 
Examples -partII
Examples -partIIExamples -partII
Examples -partII
 
Basic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manualBasic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manual
 
linux-lecture4.ppt
linux-lecture4.pptlinux-lecture4.ppt
linux-lecture4.ppt
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
 
Rhel1
Rhel1Rhel1
Rhel1
 

Recently uploaded

Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 

Recently uploaded (20)

Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 

Linux cheat sheet

  • 1. Linux/Unix Command Line Cheat Sheet - GettingGeneticsDone.blogspot.com Command Description pwd prints working directory (prints to screen, ie displays the full path, or your location on the filesystem) ls lists contents of current directory ls –l lists contents of current directory with extra details ls /home/user/*.txt lists all files in /home/user ending in .txt cd change directory to your home directory cd ~ change directory to your home directory cd /scratch/user change directory to user on scratch cd - change directory to the last directory you were in before changing to wherever you are now mkdir mydir makes a directory called mydir rmdir mydir removes directory called mydir. mydir must be empty touch myfile creates a file called myfile. updates the timestamp on the file if it already exists, without modifying its contents cp myfile myfile2 copies myfile to myfile2. if myfile2 exists, this will overwrite it! rm myfile removes file called myfile rm –f myfile removes myfile without asking you for confirmation. useful if using wildcards to remove files *** cp –r dir newdir copies the whole directory dir to newdir. –r must be specified to copy directory contents recursively rm –rf mydir this will delete directory mydir along with all its content without asking you for confirmation! *** nano opens a text editor. see ribbon at bottom for help. ^x means CTRL-x. this will exit nano nano new.txt opens nano editing a file called new.txt cat new.txt displays the contents of new.txt more new.txt displays the contents of new.txt screen by screen. spacebar to pagedown, q to quit head new.txt displays first 10 lines of new.txt tail new.txt displays last 10 lines of new.txt tail –f new.txt displays the contents of a file as it grows, starting with the last 10 lines. ctrl-c to quit. mv myfile newlocdir moves myfile into the destination directory newlocdir mv myfile newname renames file to newname. if a file called newname exists, this will overwrite it! mv dir subdir moves the directory called dir to the directory called subdir mv dir newdirname renames directory dir to newdirname top displays all the processes running on the machine, and shows available resources du –h --max-depth=1 run this in your home directory to see how much space you are using. don’t exceed 5GB ssh servername goes to a different server. this could be queso, brie, or provolone grep pattern files searches for the pattern in files, and displays lines in those files matching the pattern date shows the current date and time anycommand > myfile redirects the output of anycommand writing it to a file called myfile date > timestamp redirects the output of the date command to a file in the current directory called timestamp anycommand >> myfile appends the output of anycommand to a file called myfile date >> timestamp appends the current time and date to a file called timestamp. creates the file if it doesn’t exist command1 | command2 “pipes” the output of command1 to command2. the pipe is usually shift-backslash key date | grep Tue displays any line in the output of the date command that matches the pattern Tue. (is it Tuesday?) tar -zxf archive.tgz this will extract the contents of the archive called archive.tgz. kind of like unzipping a zipfile. *** tar -zcf dir.tgz dir this creates a compressed archive called dir.tgz that contains all the files and directory structure of dir time anycommand runs anycommand, timing how long it takes, and displays that time to the screen after completing anycommand man anycommand gives you help on anycommand cal -y free calendar, courtesy unix CTRL-c kills whatever process you’re currently doing CTRL-insert copies selected text to the windows clipboard (n.b. see above, ctrl-c will kill whatever you’re doing) SHIFT-insert pastes clipboard contents to terminal *** = use with extreme caution! you can easily delete or overwrite important files with these. Absolute vs relative paths. Let’s say you are here: /home/turnersd/scripts/. If you wanted to go to /home/turnersd/, you could type: cd /home/turnersd/. Or you could use a relative path. cd .. (two periods) will take you one directory “up” to the parent directory of the current directory. . (a single period) means the current directory .. (two periods) means the parent directory ~ means your home directory A few examples mv myfile .. moves myfile to the parent directory cp myfile ../newname copies myfile to the parent directory and names the copy newname cp /home/turnersd/scripts/bstrap.pl . copies bstrap.pl to “.” i.e. to dot, or the current directory you’re in cp myfile ~/subdir/newname copies myfile to subdir in your home, naming the copy newname more ../../../myfile displays screen by screen the content of myfile, which exists 3 directories “up” Wildcards (use carefully, especially with rm) * matches any character. example: ls *.pl lists any file ending with “.pl” ; rm dataset* will remove all files beginning with “dataset” [xyz] matches any character in the brackets (x, y, or z). example: cat do[or]m.txt will display the contents of either doom.txt or dorm.txt