Linux – List of Most Useful Commands
The following shows the list of most useful Linux commands we should know.
1. Remove/Delete Directory Recursively
rm -rf mydirectory
2. Remove/Delete File
rm myfile
3. Create a New Folder/Directory
mkdir mydirectory
4. Create a New Empty File
touch myfile
touch myfile1 myfile2 myfile3
5. Copy a Folder/Directory Recursively
cp -R source destination
6. Get/Show Current Working Directory
pwd
7. Clear Terminal Screen
clear
8. List All File in Directory
Command | Description |
|
List with long format with file size |
|
List recursively directory tree |
|
List all files including hidden file starting with ‘.’ |
|
Sort by time and date |
9. Change Permissions of File or Directory
chmode -R 755 myfile
chmode -R 755 mydirectory
10. Change File/Directory Owner
chown -R www-data:www-data mydirectory
chown -R www-data:www-data myfile
11. Compress a File/Directory Using Tar
tar -czvf output.tar /path/to/mydirectory-or-file
12. Extract a .tar File
tar -xzvf myarchive.tar
tar -xzvf myarchive.tar -C /mydir