Archives For command skill

Familiar with Linux commands? You may already know many tips and tricks that will save you a lot of time.

Here are some that I have been using for a long period of time, including Tab auto-completion, when you type something in Linux terminal and hit Tab, it auto-completes the command or file path, or outputs all possible options.

And Ctrl+Shift+V will do paste text to terminal instead of Ctrl+V. Without copying to the clipboard, you can simply select / highlight the text and use mouse middle-click to paste into terminal.

Today I found a new terminal tips that I didn’t know before. Thanks to the reddit, I’m going to share it with you by following steps.

1. Drag and drop file or folder to paste the path into terminal.

Just drag and drop a file or folder into terminal, and you’ll see the full path pasted with single quotes. It’s useful if there’s special character in file path or you just don’t want to type …

2. Drag and drop a selection of text into terminal.

You can also drag and drop a selection of text into terminal, so you don’t need to do copy and paste with context menu clicks or keyboard shortcuts.

This is a simple command line skill for beginners how to use history commands quickly and easily.

For frequently used command with a long code, you don’t need to type all the code everytime you run this command. Just type in !n, where n is a number from your history list.

For example, following is a section of my history commands:

1262 sudo apt-key adv –keyserver –recv-keys 5044912E
1263 sudo sh -c ‘echo “deb raring main” >> /etc/apt/sources.list.d/dropbox.list’
1264 sudo apt-get update
1265 sudo apt-get install dropbox

Before cleaning the history, I can run “sudo apt-get update” command by type in:


For more:

  • !! : run the previous command.
  • !n:p : only preview command number n (will not execute the command).
  • !string : Run most recent command starting with characters in string.