Bash Shell (Linux) Flashcards
cd..
Navigates back to parent directory of current directory
cd
Change directory
(Is how to navigate to a different directory in current directory)
grep
Used to search for a string of text. Consists of 2 arguments. First argument is string of text (if more than 1 word, use quotes to indicate the string). The Second argument is the file being searched
Ex: grep OS updates.txt
ls (LS)
Lists names of files and directories in current directory.
pwd
Print working directory. Displays current working directory.
clear
Bonus- what keys can also be used
Clears terminal
Bonus: CTRL+L
/ (Slash)
what is the 1st / in a file path and the difference between that and others after.
The first / indicates the root and each other / indicates the next directory path down the hierarchy.
cat
Displays the content of a file.
head
Displays the top 10(by default) lines of a file.
tail
Displays the last 10(by default) lines of a file.
-n X (replace X with any number)
Can be added to cat, head, Or tail to change the default amount of lines of a file that is displayed.
less
Bonus: what keys are used in less, and their function?
Displays content of a file one page at a time. BONUS: Spacebar -move forward a page. b -move back a page.
⬆️key -forward one line. ⬇️key -back one line. q -Quit.
whoami
Will display current user directory
(Does not move you to directory)
(piping)
Send the standard output of one command as the standard input of another command for further processing.
find
Searches files and directories that meet certain criteria.
Such as a certain ‘string of text’, a certain file size, or were last modified within a certain time frame.
- (dash)
Indicates an option.
Ex: -n (to modify the number of lines displayed)
Other Ex: -mtime, -name.
-name
Searches criteria that is case sensitive.
-iname
Searches for criteria that is not case sensitive.