Linux Cheat Sheet :
Cygwin on Windows
Commands in Course Order
Command
Usage
Comment
pwd
pwd
Print your current directory (folder) location
ls
ls
List the files in the current folder
mkdir
mkdir Blast
Make a new folder. Example Blast
cd
cd /Blast
Change to another folder like Blast
cd
cd c:/
Change to C drive
cd
cd /
Change to the root directory. Cygwin files are here
man
man pwd
Show the manual pages for all command
cat >
cat > file1
Create file1 and write data to it
cat >>
cat >> file1
Add new lines to the bottom of file1
cat
cat file1
Show/display contents of file1 to the screen
cat
cat file1 file2
Show/display contents of file1 and file2 to the screen
sort
sort file1
Sort the contents of file1
sort
sort file1 file2
Sort the contents of file1 and file2 together
alias
alias dog = “cat”
Assign the work dog to the cat command
alias
alias path = “/BioDownload/bin/”
Type
path
instead of /BioDownload/bin/
|
cat file1 file2 | sort
Called Pipe. Places output of cat into sort
head
head TA496Seq1
View the first few lines of a file, especially a large file
tail
tail TA496Seq1
View the first few lines of a file, especially a large file
less
less TA496Seq1
View a large file and control the output
cp
cp file1 file2_copy
Make a copy of file1 and call it file2_copy
cp
cp file1 /Bioinfo
Make a copy of file1 and place it in the folder Bioinfo
cp
cp file1 /Bioinfo/cp_test
Copy file1 into the folder Bioinfo and call it cp_test
mv
mv file1 /Bioinfo
Move file1 into the folder Bioinfo
rm
rm file1
Permanently delete file1
rm
rm /Bioinfo/file2
Delete file2 which is located in the Bioinfo folder
rmdir
rmdir /Bioinfo
Remove the folder called Bioinfo
grep
grep “ATG” file1
Search for ATG in file1
grep
grep “ATG” file1 file2
Search for ATG in file1 and file2
grep
grep -i “ATG” file1
Search for ATG in file1 regardless of case: Atg, atg, ATg, and so on
grep
grep -ic “ATG” file1
Search but return only a count of occurrences of all ATG
grep
An excellent reference
Commands in Alphabetical Order
Command
Usage
Comment
|
cat file1 file2 | sort
Called Pipe. Places output of cat into sort
alias
alias dog = “cat”
Assign the work dog to the cat command
alias
alias pathx = “/BioDownload/bin/”
Type
pathx
instead of /BioDownload/bin/
1
cat
cat file1
Show/display contents of file1 to the screen
cat
cat file1 file2
Show/display contents of file1 and file2 to the screen
cat >
cat > file1
Create file1 and write data to it
cat >>
cat >> file1
Add new lines to the bottom of file1
cd
cd /Blast
Change to another folder like Blast
cd
cd c:/
Change to C drive
cd
cd /
Change to the root directory. Cygwin files are here
cp
cp file1 file2_copy
Make a copy of file1 and call it file2_copy
cp
cp file1 /Bioinfo
Make a copy of file1 and place it in the folder Bioinfo
cp
cp file1 /Bioinfo/cp_test
Copy file1 into the folder Bioinfo and call it cp_test
grep
grep “ATG” file1
Search for ATG in file1
grep
grep “ATG” file1 file2
Search for ATG in file1 and file2
grep
grep -i “ATG” file1
Search for ATG in file1 regardless of case: Atg, atg, ATg, and so on
grep
grep -ic “ATG” file1
Search but return only a count of occurrences of all ATG
grep
An excellent reference
head
head TA496Seq1
View the first few lines of a file, especially a large file
less
less TA496Seq1
View a large file and control the output
ls
ls
List the files in the current folder
man
man pwd
Show the manual pages for all command
mkdir
mkdir Blast
Make a new folder. Example Blast
mv
mv file1 /Bioinfo
Move file1 into the folder Bioinfo
pwd
pwd
Print your current directory (folder) location
rm
rm file1
Permanently delete file1
rm
rm /Bioinfo/file2
Delete file2 which is located in the Bioinfo folder
rmdir
rmdir /Bioinfo
Remove the folder called Bioinfo
sort
sort file1
Sort the contents of file1
sort
sort file1 file2
Sort the contents of file1 and file2 together
tail
tail TA496Seq1
View the first few lines of a file, especially a large file
Note: there are certain words that are reserved as “commands”. For example we could not use “path” as an
1
alias, but we could use “pathx”.