Basics Flashcards
what is ‘pwd’?
Means “Print Working Directory” shows the current path you are in
‘hostname’?
Gives the name of the session hosting computer (usually your computer).
‘mkdir’?
Make directory: “mkdir temp”
how do you work with directories with spaces?
Add quotes around the name of the directory. I.e., MKDIR “new dir”
How do you create a long path nested directories with MKDIR in a single command?
MKDIR -p dir1/dir2/dir3/dir4/etc. -p means PATH
“cd”?
Change directory
“ls”?
List Directory
“RMdir”? And how to do with content inside?
Remove directory. Add -r to remove the directory and “recursively” remove all content as well.
“touch”?
Create a file
“cp”?
Copy a file or directory. CP a.txt b.txt When copying directories with stuff in it, must use the recursive flag -r to recursively copy contents as well
“mv”?
For “moving” files. But what it really does is rename the file. It’s moving the contents of a file to a new file name and deleting the old file. MV 1.txt 2.txt OR, you can move the file to a different directory name intact: MV 1.txt docs/ This also works for directories as well
“less” / “More” difference?
Both are to view a file. Less is to view in a single stream where you can page up and down. Need to hit “Q” to exit. More is to view it one page at a type linearly.
“cat”?
Short for concatenate. Use to stream a file or any concatenation of files. CAT A.txt B.txt C.txt
what does . mean?
Current directory
“rm”
Remove (delete) file or directory. Use -r to recursively delete all contents of a directory you are removing