2023-01-26
-
or --
-h
, --help
) or the command man
(for manual)ls --help
man ls
Put name in quotes if it has spaces (test code below)
touch Programming Class.txt
ls
touch "Programming Class.txt"
ls
Quotes are NORMALLY (not always) interchangeable (test code below)
echo "This is good"
echo 'This is good'
Do not start with one quote type and end with another
~
or $HOME
: your home folder (can be defined by the user).
: the folder that you are currently in..
: the folder that contains the one you are currently inCtrl+C
: cancel a commandwhoami
tab
to complete wordsCtrl+Arrow
(right or left arrow in a command line, in a text file up and down arrow too) (this works everywhere!!!)cd
cd
cd
, cd ~
and cd $HOME
are synonymscd -
- takes you to the previous folderpwd
getwd()
or python’s os.getcwd()
ls
slide 2
where we used this command>
after a command to save the outputpwd > myFolder
cat myFolder
>>
to add the current output to a previous filels >> myFolder
cat myFolder
cat
: prints the contents of the file to the screen (check slide 9
head
and tail
: prints to the screen the first/last 10 lines of the fileless
: opens the file as “read-only”
more
: opens the file as “read-only”, when the file is closed, prints it to the screennano
: open a text file to edit it.grep
: searches for a word/phrase in the file and prints the lines that match
-f
-i
or --ignore-case
Search for lines that have the word programming in the file myFolder created in slide 9
grep "Programming" myFolder
wc
: word count. Counts the number of characters, words and lines in a fileecho
: repeats the text that follows it (check slide 4
)grep
to find all the lines with sequence IDs.
""
grep
to find all the lines with sequence IDs.
""
# In all fasta files, the sequence ID line is indicated by the symbol >, so we just need to look for it
grep ">" myFasta.fa
">"
could also mean “send the output to”, which would replace the myFasta.fa filecp
: acronym for copy
cp file file2
: creates a copy of the file “file” and saves it in the file “file2”cp file folder
: creates a copy of the file “file” and saves it with the same name in the folder “folder”cp file file2 folder
: both files “file” and “file2” are copied into the folder “folder” with the same namescp folder folder2 -r
: the option -r allows the copy of the entire folder.
mv
: acronym for move. Move file from one place to another
mv file file2
: renames “file” as “file2”mv file folder
: moves “file” into the folder “folder”mv file file2 folder
: both files “file” and “file2” are moved into the folder “folder” with the same namesmv folder folder2
:
rm
: acronym for remove. Deletes files. They are PERMANENTELY deleted, there is no trash bin here!!!!!!!
rm file file2
: deletes both filesrm file file2 -i
: asks the user if they really want to delete each file, if y
is pressed, the file is deleted (-i
for interactive)mkdir
: acronym for “make directory”. Creates new folders with the specified names.
rmdir
: acronym for “remove directory”. Deletes empty folders.
rm -r folder
: as in cp
, the option -r
allows the rm
to work with a folder. It deletes everything in the folder, then deletes the folder itself