Shell Flashcards
https://www.datacamp.com/courses/introduction-to-shell-for-data-science
Which command lets you find out where you are in the filesystem?
pwd
Which command lets you list the content of your directory?
ls
Which command lets you list the content of a specific directory?
ls /path/to/file
What is the conceptual difference between asbolute and relative paths?
An absolute path is like a latitude and longitude: it has the same value no matter where you are.
A relative path, specifies a location starting from where you are: it’s like saying “20 kilometers north”.
How does the shell decide if a path is relative or absolute?
An absolute path starts with a /.
A relative path doesn’t.
Which command lets you move around the filesystem?
cd
What is the parent of a directory?
The parent of a directory is the directory above it. For example, /home is the parent of /home/repl, and /home/repl is the parent of /home/repl/seasonal.
Which special path corresponds to the one above the one you’re currently in?
..
Which path is the root directory?
/
Which path corresponds to the current directory?
.
Which path corresponds to the home directory?
~
Which command lets you copy files?
cp path/original.txt path/duplicate.txt
How do you copy several files to a directory?
cp original1.txt original2.txt path/to/directory
Which command lets you move files from on directory to another?
mv path/to/file1.txt path/to/file2.txt path/to/directory
Which command lets you rename a file?
mv old_name.txt new_name.txt
Which command lets you remove files?
rm file/to/file1.txt file/to/file2.txt
What happens if you move or copy to an existing filename?
The original file with that filename is overwritten.
Which command lets you remove an empty directory?
rmdir directory_name
Which command lets you create a directory?
mkdir directory_name
Where should you store files and programs you only need briefly?
/temp
Which command lets you look at the content of files?
cat file1.txt file2.txt
When printing the content of a file, how do you go to the next page?
Press the spacebar
When printing the content of a file, how do you quit?
Press q
When printing the content of several files, how do you move to the next file?
Type :n