1. ls – List Directory Contents
The ls
command is used to list the contents of a directory. Here are some example usages:
ls
: List files and directories in the current directory.ls /path/to/directory
: List files and directories in the specified directory.
2. cd – Change Directory
The cd
command is used to change the current working directory. Example usage:
cd /path/to/directory
: Change the current directory to the specified directory.
3. pwd – Print Working Directory
The pwd
command prints the current working directory. Example usage:
pwd
: Print the current working directory.
4. mkdir – Make Directory
The mkdir
command is used to create directories. Example usage:
mkdir directory_name
: Create a directory with the specified name.
5. rm – Remove
The rm
command is used to remove files and directories. Example usage:
rm file_name
: Remove the specified file.rm -r directory_name
: Remove the specified directory and its contents recursively.
6. cp – Copy
The cp
command is used to copy files and directories. Example usage:
cp file1 file2
: Copyfile1
tofile2
.cp -r directory1 directory2
: Copydirectory1
and its contents recursively todirectory2
.
7. mv – Move
The mv
command is used to move or rename files and directories. Example usage:
mv file1 file2
: Movefile1
tofile2
or renamefile1
tofile2
.mv file1 /path/to/directory
: Movefile1
to the specified directory.
8. touch – Create Empty File
The touch
command is used to create an empty file or update the timestamp of an existing file. Example usage:
touch file_name
: Create an empty file with the specified name.
9. cat – Concatenate and Display
The cat
command is used to concatenate files and display their contents. Example usage:
cat file1 file2
: Concatenate and display the contents offile1
andfile2
.cat file_name
: Display the contents of the specified file.
10. nano – Text Editor
The nano
command is a simple text editor used for editing files in the terminal. Example usage:
nano file_name
: Open the specified file in the nano text editor.
11. grep – Search
The grep
command is used to search for patterns in text files. Example usage:
grep pattern file_name
: Search for the specified pattern in the specified file.grep -r pattern directory
: Search for the specified pattern recursively in the specified directory.
12. sudo – Superuser Do
The sudo
command is used to execute commands with superuser privileges. Example usage:
sudo command
: Execute the specified command with superuser privileges.
13. apt-get – Package Manager
The apt-get
command is used to manage packages on Ubuntu. Example usage:
sudo apt-get update
: Update the package lists for available upgrades.sudo apt-get install package_name
: Install the specified package.sudo apt-get remove package_name
: Remove the specified package.
14. dpkg – Package Manager
The dpkg
command is used to install, remove, and manage individual packages. Example usage:
sudo dpkg -i package_file.deb
: Install the specified package from a .deb file.sudo dpkg -r package_name
: Remove the specified package.
15. chmod – Change Mode
The chmod
command is used to change the permissions of files and directories. Example usage:
chmod permissions file_name
: Change the permissions of the specified file.chmod permissions directory_name
: Change the permissions of the specified directory.
16. chown – Change Owner
The chown
command is used to change the owner of files and directories. Example usage:
chown new_owner file_name
: Change the owner of the specified file.chown new_owner:new_group file_name
: Change the owner and group of the specified file.
17. tar – Tape Archive
The tar
command is used to archive and extract files. Example usage:
tar -cvf archive_name.tar files
: Create a new archive file.tar -xvf archive_name.tar
: Extract files from an archive.
18. uname – Print System Information
The uname
command prints system information. Example usage:
uname -a
: Print all system information.uname -r
: Print the kernel release.
19. date – Display Date and Time
The date
command is used to display the current date and time. Example usage:
date
: Display the current date and time.date "+%Y-%m-%d"
: Display the current date in YYYY-MM-DD format.
20. shutdown – Shutdown or Restart System
The shutdown
command is used to shutdown or restart the system. Example usage:
sudo shutdown now
: Shutdown the system immediately.sudo shutdown -r now
: Restart the system immediately.
21. ps – Process Status
The ps
command is used to display information about active processes. Example usage:
ps
: Display information about active processes.ps aux | grep process_name
: Display information about processes matching the specified name.
22. top – Display System Activity
The top
command is used to display real-time system activity. Example usage:
top
: Display real-time system activity.top -u username
: Display system activity for the specified user.
23. du – Disk Usage
The du
command is used to display disk usage. Example usage:
du
: Display disk usage of the current directory.du -h
: Display disk usage in human-readable format.
24. df – Disk Free
The df
command is used to display disk space usage. Example usage:
df
: Display disk space usage of all mounted filesystems.df -h
: Display disk space usage in human-readable format.