Linux Commands Flashcards
Command to show current working directory?
pwd
Command to show the username?
whoami
________ is the top-most directory in Linux.
root directory
________ will take you to the parent directory or one step up.
cd ..
__________ command will take you to the previous used directory.
cd -
Different ways to clear the Linux screen?
clear
Ctrl + L
Command to show all the files or directories?
ls
Command to display the newest file or directory first?
ls -l
ls -lt
Command to display the oldest file or directory first?
ls -ltr
Command to display the oldest file in a directory first?
ls -lR
How to recursively print all the directories and files?
ls -R
Command to display all the files including the hidden files that are starting with dot(.)?
ls -a
What is the Linux command to print all files and folders recursively including the hidden files?
ls -R -a
or ls -Ra
or ls -aR
What does ls -latR command display?
Recursively display all files and directories including the hidden files based on timestamp i.e. the newest one first.
l - long listing.
a - including the hidden files.
t - new ones come first.
R - Recursively print all files and directories.
How to create an empty file?
touch filename
Command used to change permissions of a file?
chmod
How to change the permission of the file from ‘-rw-r–r–’ to ‘-rwxrw-r–’?
chmod 764 filename
Command to create a directory?
mkdir
chmod 644 file1.
What is the permission given to file1?
-rw-r–r–
Command used to display the content in the file?
cat filename
How to delete an empty directory?
rmdir dirName
This command will only work when a directory is empty and if it is not empty it shows an error.
Command to delete a file?
rm fileName
Command to delete a directory with files in it?
rm -R dirName
what is the Linux command used to copy?
cp