CLI-beginning Flashcards
Most commands can take [***], sometimes also called options or flags: arguments that modify how a command is carried out.
switches
The timestamp indicates…
the last time teh content was modified
Do we always need to be within a directory to use the list command?
No, we can pass the path of a directory as argument to the ls command.
For instance, from your home directory, you can type:
ls Documents/
ls Documents/my-website
ls Documents/my-website/css
Etc.
How to get the terminal to indicate the current location (current directory) by showing its absolute path?
pwd
Single-character arguments can often be [***]
combined together
ls -l -F
can be replaced by
ls -lF
(dash + lowercase “L” for details + uppercase “F” for trailing slash after directories’ names)
What character can be used when writting paths as a shortcut /alias for your home directory?
the tilde character: ~
For instance, the two following paths are actually the same:
- /Users/lecorre/Documents/my-website
- ~/Documents/my-website
What is the command to create a new directory/folder?
mkdir
Ex: mkdir css
Will create a folder named css in the active directory
What default character is used for the prompt?
The dollar character:
$
(It can be customized)
What is the command to list with the following options:
- with the details
- by time –> with the newest files at the bottom
ls -ltr
ls = listing
- l = with the details
- t = order by time (newest first)
- r = reverse order
Which switch will order by time with newest content first?
-t
What does the double dot stand for?
As on the web, the double dot (..) symbol represents the current directory’s parent.
So it also works from a shell prompt:
ls ..
cd ..
What is the switch for the ls (list) command that will add a trailing slash to the directories—to make it easier to distinguish files from folders?
-F
(dash + uppercased “F”)
Which switch will reverse the order?
-r
What does -rw-r–r-rwxr-xr-x mean on the output of a list command? And what does it mean when there’s a d before?
It’s the about the permissions: read, write, execute.
If there’s a d before, it’s to indicate that it’s a directory (not a file);
How to list the current working directory’s files and subdirectories?
By typing:
ls
(lowercase “L” and “S” –> like listing)