Boost Your Linux Command Line Productivity Right Now!

Boost Your Linux Command Line Productivity Right Now!

·

4 min read

Part 1 : 13 Essential Linux Commands for Your Daily Workflow

💡
Use "Dark Mode" To Read This Blog Please For Better Experience.
  1. Navigation
    (Use these commands to to move inside the file system and know the contents of specific path in the file system):

    • ls: This command lists the contents of the current directory. Use flags like -l for detailed listings or -a to show hidden files. Just like in windows we double click and see the contents of a folder, ls command is the same thing.

    • cd: Change directories with cd. Navigate to your home directory with cd ~ or move up a directory level with cd ..

  2. File & Folder Creating & Deletion:
    (Use these command to create a file or a folder)

    • mkdir: Create new directories(folder) using mkdir
      For example: mkdir folder1 will create a folder named folder1 in the current directory you are in.
      Need a subdirectory structure? Chain commands like mkdir project/data/reports.

    • touch: Create empty files with touch.
      For example: touch file.txt will create a file with name file.txt in the current directory you are in.

    • echo: Echo just print some text to the command line but we can use it to add some content to the file we are creating. Use the echo & touch commands together to create a file, but with some content in it.
      For example: echo "Hello I am content!" > touch file.txt

    • rm: Okay we know how to make folder and files but how to delete them?
      Use rm for that. Navigate to the folder that contains the file you want to remove then use rm <file_name_here> this will delete the file name specified.

      Removing folder is not same though, use -r option with rm.
      Use rm -r <folder_name> to delete a folder and its files too.

  3. Viewing Files:

    • cat: Display the contents of a file.
      For example: cat file.txt will show all the content of this file.

    • tail: Want to see the last few lines of the file?
      Pipe cat with tail: cat file.txt | tail -n 5.

    • head: Want to see the top few lines?
      Pipe cat with head: cat file.txt | head -n 5.

    • less: For larger files, use less for a pager view. Navigate with arrow keys and exit with q.

  4. Know exactly where you are & your storage usage:

    • pwd: This simple command prints the absolute path(means complete path) of your current working directory. Essential for knowing your current location in the file system.

    • df: Check disk usage with df. Identify partitions running low on space and plan your storage accordingly.

  5. Know which processes are running in the system:

    • ps: See a list of running processes with ps. Use flags like -aux for a more detailed view including user, PID, and CPU usage.

Part 2 : Learn how to quick move the cursor in terminal & Move Between Command History

  • Ctrl+A: Instantly move your cursor to the absolute beginning of the line for quick edits.

  • Ctrl+E: Counterpart to Ctrl+A, this places your cursor at the line's end, perfect for appending text.

  • Backspace/Delete: Delete characters; backspace removes the character behind the cursor, while Delete removes in front.

  • Ctrl+W: Delete the entire word(just one word not everything) left of your cursor for faster corrections.

  • Ctrl+U/Ctrl+K: For larger deletions,
    Ctrl+U wipes everything from the left of the cursor, while Ctrl+K clears everything from the right of the cursor.

Time Traveling Through History:
(When we write commands, they go to the history, from which we can retrieve them back)

  • Up/Down Arrows: These cycle through your command history, allowing you to recall and edit past commands.

  • !!: Execute the last command you typed again with a double bang. Need the second-to-last command? Use ! followed by the history number (!-2).

  • Ctrl+R: Enter reverse search. Start typing characters, and the terminal will navigate through your history based on what you enter. Press Ctrl+R again to cycle through matching entries, Ctrl+O to accept and execute the highlighted command, or Ctrl+G to exit the search.


The END

That's It, for daily use and normal usage, these are the only commands and tricks you need 80%-90% of the time. Of course i will make more blogs on advanced stuff but for daily usage this is kind of enough.

Love You Thanks!

Â