4. Files and Directories Management in Linux Flashcards
What is the representation of the root directory?
/
How is represented the home directory of a user?
~
What is the command to know in which directory we’re currently in?
pwd (Print Working Directory)
What does an absolute path start with in linux?
a “/”
What is the command to change directory?
cd (Change Directory)
How do I get directly back to my home directory?
With just the command “cd”
What are the two types of paths in linux?
absolute and relative.
What does the . (dot) represent with the cd command?
The current directory
what does the .. (two dots) represent with the cd command?
The parent directory
What is the keyboard shortcut to autocomplete path and see all possible files with cd command ?
Taping twice the tab key.
What is the shorcut to complete the path with cd command?
Taping once the tab key.
What is the command to list all file inside the current folder?
ls
What is the command to list files with details?
ls -l
What is the command to see file size in human notation ?
ls -lh
What is the command to list files with types?
ls -F
What is the command to see hidden files?
ls -a
What is the meaning of the colour of a file?
no colour = file
blue = directory
cyan = link
How are the directories displayed with the command ls -l ?
Permissions - number of links - user - group - size (Bytes) - date of creation / modification - name
In permissions, what is the meaning of the first character?
Nothing = file
d = directory
l = link
What is the meaning of the three parts of permissions?
1 -> User
2 -> Group
3 -> all other users
What are the different permissions?
r (read) - Can list files in the directory.
w (write) - Can rename, create, and delete files in the directory.
x (execute) - Can “cd” into the directory and grant access files.
What is the meaning of the last character with the command “ls -F” ?
/ -> directory
@ -> link
nothing -> file
How do you recognize a hidden file?
it always starts with a . (dot)
Is it a good thing to create files and folders in the root directory? Yes or no ?
if no, where should you create them ?
No. we should create them in the home directory.
What is the * character used for?
It is a wild card.
What is the directory “etc” used for?
It contains different configuration files.
What is the shortcut to move to the beginning or ending of the command?
ctrl+a and ctrl+e
Why is a file coloured in green?
Because it is executable.
What is the command to create a folder?
mkdir
What does the command “mkdir -p” do?
Create the parent directory if non existing.
What does the command “rm -r” do?
It removes a directory, and its content recursively.
What is the command to create an empty file?
touch
What is the main use of the touch command?
Update the modification of a file to the current time.
What are the two main text editors?
Vim and nano
What is the vim command to close it?
:q
How do I close nano?
ctrl+x
How do I start editing in vim?
Shift + i
How to exit a mode in Vim?
Press the escape key.
What is the command to save changes and close vim editor?
:wq
How to cut text in nano?
ctrl + k
How to get help in the nano editor?
ctrl + G
How do I search text in nano ?
ctrl + w
How do I replace text in nano?
ctrl + \
How do I write change in nano?
ctrl + o
What is the command to copy a file?
cp
What is the command to copy a folder recursively?
cp -r
What is the command to see the history of commands?
history
How to represent all files in directory?
*
How to move and / or rename a file?
mv
What is the command to read the first 10 lines of a file?
head
What is the command to read the last 10 lines of a file?
tail
What is the command to specifically have the number of lines I want to read from a specific file at the beginning or the end?
head / tail -n
What is the key to scroll through text with the command “more”?
it is the space key
What is the command to see the data of a file updating in real time?
tail -f
What is the command to filter a STDIN by piping?
grep
What is the character that allows to look for line that starts with a specific character?
^ (caret)
What is the character that allows to look for line that ends with a specific character?
$
How do i escape a character?
\
What is a soft link?
It is a pointer to a specific file.
What is a hard link?
It’s when one or more files have the same inode.
What is the command to create a soft link?
ln -s
What is the command to create hard link?
ln