Commonly Used Linux Commands
Notes on some of the most commonly used Linux Commands.
1. ls - List Directory Contents
ls - List Directory ContentsDisplays files and directories within a given directory.
Popular flags:
-l: Long listing format (permissions, owner, size, etc.)-a: Show all files, including hidden files-h: Human-readable file sizes
2. cd - Change Directory
cd - Change DirectoryUsed to navigate between directories.
Popular usage:
cd /path/to/directory: Navigate to a specific directorycd ..: Move to the parent directorycd ~: Move to the home directory
3. pwd - Print Working Directory
pwd - Print Working DirectoryDisplays the full path of the current directory.
Popular usage:
No common flags; it simply prints the path of your current directory.
4. cp - Copy Files and Directories
cp - Copy Files and DirectoriesCopies files or directories from one location to another.
Popular flags:
-r: Recursive copy (used for directories)-v: Verbose (shows the progress of the copy)-i: Interactive (prompts before overwriting files)
5. mv - Move or Rename Files and Directories
mv - Move or Rename Files and DirectoriesMoves files or directories to a new location or renames them.
Popular flags:
-v: Verbose (shows the progress of the move)-i: Interactive (prompts before overwriting files)
6. rm - Remove Files or Directories
rm - Remove Files or DirectoriesDeletes files or directories.
Popular flags:
-r: Recursive (used to delete directories and their contents)-f: Force delete (no confirmation prompts)-v: Verbose (shows what is being deleted)
7. chmod - Change File Permissions
chmod - Change File PermissionsModifies the read, write, and execute permissions for files and directories.
Popular flags:
-R: Recursive (change permissions for all files in a directory)
8. chown - Change File Ownership
chown - Change File OwnershipChanges the ownership of a file or directory to a different user or group.
Popular flags:
-R: Recursive (change ownership for all files in a directory)--from=<current_owner>: Change ownership from a specific user
9. ps - Process Status
ps - Process StatusShows information about the running processes.
Popular flags:
-e: Show information for all processes-f: Full-format listing-aux: Displays detailed information about processes
10. top - Real-Time System Resource Usage
top - Real-Time System Resource UsageShows a real-time view of system processes, CPU, and memory usage.
Popular flags:
-d <time>: Set delay time between updates
11. cat - Concatenate and Display File Contents
cat - Concatenate and Display File ContentsDisplays the contents of a file.
Popular flags:
-n: Number all output lines-E: Display$at the end of each line
12. grep - Search Through Text
grep - Search Through TextSearches for specific patterns in files or text.
Popular flags:
-i: Case-insensitive search-r: Recursive (search in all subdirectories)-v: Invert match (show lines that do not match the pattern)
13. find - Search for Files and Directories
find - Search for Files and DirectoriesSearches for files and directories based on various criteria.
Popular flags:
-name <name>: Search for a file by name-type <d|f>: Search by file type (d for directory, f for file)-exec <command>: Execute a command on each file found
14. sudo - Superuser Do
sudo - Superuser DoRuns commands with elevated (root) privileges.
Popular usage:
sudo <command>: Run a command with root privileges
15. apt - Package Manager for Debian-Based Systems
apt - Package Manager for Debian-Based SystemsUsed to manage software packages.
Popular flags:
update: Updates the package listupgrade: Upgrades all installed packages to the newest versionsinstall <package>: Installs a new package
16. df - Disk Space Usage
df - Disk Space UsageShows the available and used disk space on mounted filesystems.
Popular flags:
-h: Human-readable output-T: Show the file system type
17. du - Disk Usage
du - Disk UsageEstimates and displays the space used by files and directories.
Popular flags:
-h: Human-readable output-s: Summarize the total size of a directory
18. tar - Archive Files
tar - Archive FilesUsed for creating and extracting archives.
Popular flags:
-c: Create a new archive-x: Extract files from an archive-v: Verbose (show the progress)-z: Compress the archive using gzip
19. wget - Download Files from the Web
wget - Download Files from the WebDownloads files from the web via HTTP, HTTPS, and FTP.
Popular flags:
-q: Quiet (no output)-O <file>: Output the download to a specific file name
20. ssh - Secure Shell
ssh - Secure ShellUsed for remote login to another machine.
Popular flags:
-p <port>: Specify the port number-i <identity_file>: Use a specific identity file (private key) for authentication
21. man - Manual Pages
man - Manual PagesDisplays the manual for a command.
Popular usage:
man <command>: Show the manual page for a specific command
Last updated
