ls
Lists all files and directories in the current directory.
Example: ls will show files and directories like Documents, Downloads, etc.
cd
Changes the current directory.
Example: cd Documents will move you into the “Documents” directory.
pwd
Prints the current working directory.
Example: pwd will output something like /home/diksha/Documents.
touch
Creates an empty file.
Example: touch file.txt will create a new empty file named file.txt.
mkdir
Creates a new directory.
Example: mkdir new_folder will create a directory named new_folder.
rm
Removes files or directories.
Example: rm file.txt will delete file.txt.
To remove a directory and its contents, use rm -r directory_name.
cp
Copies files or directories.
Example: cp source.txt destination.txt will copy source.txt to destination.txt.
mv
Moves or renames files or directories.
Example: mv oldname.txt newname.txt will rename the file, or mv file.txt /path/to/destination/ will move it.
cat
Displays the contents of a file.
Example: cat file.txt will show the text inside file.txt.
chmod
Changes file permissions.
Example: chmod 755 file.sh gives read, write, and execute permissions to the owner, and read and execute permissions to others.
ps
Displays currently running processes.
Example: ps will show a list of processes along with their process IDs (PIDs).
kill
Terminates a process by its PID.
Example: kill 1234 will terminate the process with PID 1234.
sudo
Runs a command with superuser (admin) privileges.
Example: sudo apt-get update updates the package list with root permissions.
df
Shows disk space usage.
Example: df -h displays the available and used disk space in human-readable format.
top
Displays real-time information about system processes.
Example: top will show a live view of CPU, memory usage, and running processes.
man
Displays the manual for a command.
Example: man ls will show the manual page for the ls command.
Leave a Reply