Essential Linux Commands for Everyday Use

Linux commands serve as powerful tools for navigating the operating system, managing processes, and retrieving vital system information. Here’s a breakdown of essential commands categorized by function:


Files & Navigation

  1. ls: List files and directories in the current directory.
    • Example: ls -l displays detailed file information.
  2. cd: Change directory.
    • Example: cd /home/user/documents navigates to the “documents” directory.
  3. pwd: Print the current working directory.
    • Example: pwd shows the current directory path.
  4. mkdir: Create a new directory.
    • Example: mkdir new_folder creates a directory named “new_folder”.
  5. cp: Copy files and directories.
    • Example: cp file.txt destination_folder copies “file.txt” to the “destination_folder”.

Networking

  1. ping: Test network connectivity to a specific IP address.
    • Example: ping 8.8.8.8 checks connectivity to the Google DNS server.
  2. ifconfig: Display network interface information.
    • Example: ifconfig shows network interface details.
  3. ssh: Securely connect to a remote machine.
    • Example: ssh username@remote_host initiates an SSH connection.
  4. netstat: Display network statistics.
    • Example: netstat -tuln shows listening ports.
  5. curl: Transfer data from or to a server.
    • Example: curl example.com retrieves data from the specified URL.

Processes

  1. ps: Display information about active processes.
    • Example: ps aux shows all running processes.
  2. kill: Terminate processes by ID or name.
    • Example: kill PID terminates a process using its process ID.
  3. top: Display real-time system information and processes.
    • Example: top shows system statistics and running processes.
  4. killall: Terminate processes by name.
    • Example: killall process_name stops all processes with the given name.
  5. nice: Run a command with modified scheduling priority.
    • Example: nice -n 10 command runs a command with lower priority.

System Info

  1. uname: Display system information.
    • Example: uname -a shows kernel information.
  2. uptime: Show system uptime and load averages.
    • Example: uptime displays system uptime.
  3. free: Display system memory usage.
    • Example: free -m shows memory statistics in MB.
  4. df: Show disk space usage.
    • Example: df -h displays disk space in a human-readable format.
  5. lscpu: Display CPU information.
    • Example: lscpu shows detailed CPU information.

Permissions

  1. chmod: Change file permissions.
    • Example: chmod 755 file.txt grants read, write, and execute permissions to the file owner.
  2. chown: Change file owner.
    • Example: chown user:group file.txt changes the file’s owner and group.
  3. chgrp: Change group ownership of files.
    • Example: chgrp new_group file.txt changes the file’s group.
  4. ls -l: List files with detailed permissions.
    • Example: ls -l file.txt displays file permissions.

Other Commands

  1. grep: Search for specific patterns in files.
    • Example: grep "search_term" file.txt searches for “search_term” in the file.
  2. tar: Create or extract tar archives.
    • Example: tar -cvf archive.tar directory creates a tar archive.
  3. find: Search for files and directories.
    • Example: find / -name file.txt searches for “file.txt” in the root directory.
  4. man: Access the manual pages for commands.
    • Example: man command_name displays the manual for the specified command.
  5. echo: Display text on the terminal.
    • Example: echo "Hello, Linux!" prints the specified text.

Understanding and utilizing these fundamental Linux commands can significantly enhance your efficiency and productivity within the Linux environment.

Want to Listen to This Guide While Working?

Try Speechify — the AI voice reader that helps DevOps engineers consume technical documentation while working in the terminal.