Linux Commands Flashcards
Is Linux same as UNIX?
No, they are not the same.
They are different OS and UNIX was created long before Linux, which is said to be UNIX-like OS.
Linux is used pretty much everywhere, PCs, servers, game dev, mobiles etc while unix is mostly used in servers, workstations
What is:
cd ~
Go to home dir of current user
Absolute path vs relative path?
Absolute always starts from root /root/home/kmylonas/Document
If a path starts with / then its an absolute path.
Relative is from where you are now for example if you’re kmylonas:
cd Documets or cd ./Documentrs
rmdir can only remove empty directories?
Yes
How to remove non empty dir?
rm -r
Whats the difference between && and ; ??
&& executes sequence of commands only if all of them succeed
; executes sequence of commands independently, some may fail
What does:
chmod 753 file.txt
file.txt permissions:
user: rwx
group: rx
others: wx
It is equivalent to:
chmod u=rwx,g=rx,o=wx file.xt
Use case of chmod -R ?
-R is used to change permission to directory and its contents
What is a softlink and how to create it?
A softlink is like a shortcut in windows.
Create it with ln -s original_file shortcut_file
Changes to softlinks apply to original file?
Yes
What happens to soft links when you delete their original file?
They have no use..
Can you have a softlink for directories?
Yes
How to create hardlinks?
ln sourcefile hardlinkname
ls -l shows the number of softlinks or hardlinks?
Number of hardlinks
Can you create hardlink for directories?
No.
Should you use absolute path or relative when creating links?
According to giatrakos, absolute path
If you have an original file and a hardlink, what happens when you delete the original file?
You can still access the original data through the hardlink.
What fits to the ?
find -type ? -name “file*”
? can be f if you want files whose name start with “file”
? can be d if you want directories …
if no type set then find command returns everything