Linux (BASH) sample commands Flashcards
/
root directory
ls
list directories
ex. ls/ lists directories in main directory
ls -help
tells what command flags are and what they do
man -ls
same information as “-help” but with a little more detail
ls -long
extra information about directories and files and folders in them
- this is like windows “show properties”
ls -a
all files in the directory including hidden files
History (or ctrl+r)
show previous commands and navigate up and down to execute them again
clear
clear screen that is cluttered
mv
renames or moves files to a different directory
to change name just type mv and the original name and then the new name right after it
rm
remove files and directories
cat
gets contents of a file and outputs the contents to the screen
less
=more in windows
gets the contents of the file (especially a larger one and displays it to the terminal window until it fills it. You can then advance content at your own pace)
up and down keys
advances contents of the screen by one line after “less” command
page up and page down keys
advances contents of the screen by one page after less command
lowercase g
moves to the beginning of a file after less command
capital G
moves to the end of a file after the less command
/[word}
/word-search - allows you to search for a word or phrase
q
quit out of the less command and return to the shell
cat -head
displays first few lines of a file (by default 10 lines)
cat -tail
displays the last few lines of a file (by default 10)
nano [file name]
text editor like notepad++ in windows
ctrl key
grep
searches for a string in a group of files
like the select-string in powershell
(pipe character)
send command
it sends or “pipes” output to next location
cp
copy files
-r
recursive copy
>
redirect command for standard output
> >
append (add) to a file
<
standard input operator (redirector)
/dev/null
sends unwanted output to the netherworld
like $null in windows powershell
2>
redirector for standard error (stderr)