Linux Commands - ZishanManna/interview-prep-wiki GitHub Wiki

Linux Commands

Sl No Command Description
1 pwd Gives the present working directory.
pwd -L Displays the symbolic path of the current directory.
pwd -P Displays the actual path of the current directory.
2 cd <directory name> Changes the present working directory to the specified <directory name>.
cd .. Navigates to the parent directory of the current directory.
cd <dir_1>/<dir_2> Changes the current working directory to the specified path, moving into dir_2 inside dir_1.
cd ~ Takes you to the home directory of the current user.
3 ls Lists the files and directories in the current working directory.
ls -l Provides a detailed list of files and directories with permissions, ownership, size, and date.
ls -a Lists all files, including hidden files (those that start with a dot).
4 mkdir <directory name> Creates a new directory with the specified name.
5 rmdir <directory name> Removes an empty directory with the specified name.
6 rm <file name> Deletes the specified file.
rm -r <directory name> Recursively deletes a directory and its contents.
7 cp <source> <destination> Copies a file or directory from the source to the destination.
cp -r <source_dir> <dest> Recursively copies a directory and its contents.
8 mv <source> <destination> Moves or renames a file or directory.
9 cat <file name> Displays the contents of a file in the terminal.
10 man <command> Displays the manual page for a specified command, providing details on its usage and options.
11 touch <file name> Creates an empty file or updates the timestamp of an existing file.
12 echo <text> Displays the specified text or variables in the terminal.
13 clear Clears the terminal screen.
14 history Displays the command history for the current session.
15 grep <pattern> <file> Searches for a specified pattern in a file and displays the matching lines.
16 find <directory> -name <name> Searches for files in a directory hierarchy matching a specified name.
17 chmod <permissions> <file> Changes the permissions of a file or directory.
18 chown <user>:<group> <file> Changes the ownership of a file or directory to the specified user and group.
19 df -h Displays information about disk space usage for all mounted filesystems in a human-readable format.
20 du -h <directory> Displays the disk usage of a specified directory and its contents in a human-readable format.
21 ps Displays the currently running processes.
ps aux Shows detailed information about all running processes.
22 kill <pid> Terminates a process with the specified process ID (PID).
23 ping <hostname> Sends ICMP echo requests to a specified hostname or IP address to test connectivity.
24 scp <source> <destination> Securely copies files between hosts on a network using SSH.
25 wget <url> Downloads files from the specified URL.

For more details, refer to GitHub Linux Course Wiki.

⚠️ **GitHub.com Fallback** ⚠️