Linux Flashcards
Pwd
Present working directory
What is this symbol: ~
Tilde
What does the ~ sign expand to?
The full path for your home directory
Why is understanding where you are at any given time in your file system important?
This information can help you build paths to other files or help you if you get lost.
By default, Pwd will list the “logical” path of your current directory. What does this mean?
It will treat say linked paths as if they were the actual paths.
If you want to see the actual physical path of the directory in which you are working, what flag can you use?
pwd -P
What is the command for listing files and directories?
ls
How do you find out what files are in another directory?
Pass a path to the ls command.
It is common for Unix and Linux based machines to have ‘invisible’ or ‘hidden’ files that are prefixed with a ___.
‘dot’
What flag can you use to see hidden files?
ls -a
What is the flag for listing files and directories in long form?
ls -l
What is symlink short for?
Symobolic link
What flag can you use to see sizes of files in kilobytes and megabytes?
ls -lh
What is the default method of sorting a list of files and directories?
By name
How can we change the list function to sort by size (largest first)?
ls -lS
What flag can we use to list files and directories by the last time they were modified?
ls -lt
How can we reverse the sort of any of the sorting flags for the ls command?
-r
What is the command for creating a link?
ln
By default, the ln command will create a ____ link between files.
hard
What happens when you create a hard link?
Hard links create an identical copy of the linked file on disk, which gets updated automatically as the source file gets updated.
How do we create a link to a file using the ln command?
We call the ln command with two arguments - the first being the source file and the second being the target file.
Can hard links connect two file systems?
No they only work on the current file system. Symbolic links can link to files on different file systems.
If the source file of a hard link gets deleted, what will happen to the target file?
It will continue to live as an independent file, despite the severed link.
If the file you are trying to link a file that already exists, you will get an error. How can you force the system to link the files anyway (deleting whatever you have saved in that file).
-f (force)
Do hard links work for directories?
No, only symlinks
How do we create a symlink?
ln -s
Which of the kinds of links are more powerful and more common?
Symlinks
How do you change directories?
cd
What one argument does cd take?
The path to the directory you wish to naviagate to.
What is the special path . . used for?
Moving to the current directories parent directory.
What happens when you call cd without any arguments?
You will go back to the home directory.
What command do you use to create new directories?
mkdir
What flag can you use to make nested directories?
mkdir -p parent_file/sub_file/double_sub
When would you use the -v flag?
Using the -v flag can provide useful reporting when writing scripts that will execute a lot of commands for you.
What is the name of the -v flag?
Verbose Output