50 Essential Linux Commands Every Sysadmin Should Master
For users who want a no-nonsense, technical rundown of key Linux commands, here’s a curated list of 50 commands with fresh wording and a re-ordered sequence to boost your productivity on the command line.
-
pwd – Displays your current working directory.
Example:pwd
-
cd – Changes your directory to the specified path.
Example:cd /path/to/directory
-
ls – Lists files and folders in the current directory.
Example:ls -la
-
mkdir – Creates a new directory.
Example:mkdir new_folder
-
touch – Generates an empty file or updates the timestamp on an existing file.
Example:touch newfile.txt
-
rm – Deletes files or directories (use with caution).
Example:rm unwanted_file.txt
-
cp – Copies files or directories from one location to another.
Example:cp source.txt destination.txt
-
mv – Moves or renames files and directories.
Example:mv oldname.txt newname.txt
-
rmdir – Removes an empty directory.
Example:rmdir empty_folder
-
cat – Outputs the content of a file to the terminal.
Example:cat file.txt
-
less – Opens files in a paginated view for easier reading and backward scrolling.
Example:less file.txt
-
more – Similar to less, it displays file content page by page.
Example:more file.txt
-
head – Shows the first few lines of a file.
Example:head -n 10 file.txt
-
tail – Displays the last part of a file; useful for log files.
Example:tail -n 10 file.txt
-
find – Searches for files and directories based on specified criteria.
Example:find / -name "targetfile.txt"
-
grep – Filters text or searches for specific patterns within files.
Example:grep "search_term" file.txt
-
locate – Quickly finds files by name using a prebuilt database.
Example:locate file.txt
-
which – Reveals the full path of shell commands.
Example:which python3
-
whereis – Locates the binary, source, and manual pages for a command.
Example:whereis gcc
-
chmod – Modifies file or directory permissions.
Example:chmod 755 script.sh
-
chown – Changes the owner and/or group of a file or directory.
Example:sudo chown user:group file.txt
-
df – Reports disk space usage of file systems.
Example:df -h
-
du – Estimates the file space usage of directories and files.
Example:du -sh /path/to/directory
-
free – Displays memory usage statistics.
Example:free -m
-
top – Provides a real-time view of system processes and resource usage.
Example:top
-
ps – Lists current running processes.
Example:ps aux
-
kill – Terminates a process by its Process ID (PID).
Example:kill 1234
-
killall – Ends processes by name instead of PID.
Example:killall process_name
-
history – Shows a list of previously executed commands.
Example:history
-
alias – Creates shortcuts for longer commands.
Example:alias ll="ls -la"
-
echo – Prints text or variable values to the terminal.
Example:echo "Hello, World!"
-
uname – Displays system information such as the kernel name and version.
Example:uname -a
-
date – Outputs or sets the current date and time.
Example:date
-
cal – Presents a simple calendar.
Example:cal
-
man – Opens the manual page for other commands.
Example:man ls
-
ssh – Securely connects you to a remote system over a network.
Example:ssh user@hostname
-
scp – Securely copies files between hosts using SSH.
Example:scp file.txt user@remote:/path/to/directory
-
wget – Retrieves files from the web via HTTP, HTTPS, or FTP.
Example:wget https://example.com/file.zip
-
curl – Transfers data with URL syntax; often used for API interactions.
Example:curl -O https://example.com/file.zip
-
tar – Archives multiple files into a single file, often for backup purposes.
Example:tar -czvf archive.tar.gz /path/to/directory
-
gzip – Compresses files using the GNU zip algorithm.
Example:gzip file.txt
-
gunzip – Decompresses files that were compressed with gzip.
Example:gunzip file.txt.gz
-
zip – Combines and compresses files into a zip archive.
Example:zip archive.zip file1.txt file2.txt
-
unzip – Extracts files from a zip archive.
Example:unzip archive.zip
-
ping – Sends ICMP echo requests to test network connectivity.
Example:ping google.com
-
traceroute – Tracks the route packets take to a network host.
Example:traceroute google.com
-
netstat – Displays network connections, routing tables, and interface statistics.
Example:netstat -tuln
-
ip – Manages and displays networking, replacing older tools like ifconfig.
Example:ip addr show
-
sudo – Executes commands with superuser privileges.
Example:sudo apt-get update
-
apt-get – Handles package management for Debian-based systems.
Example:sudo apt-get install package_name