10 Interesting Linux Command Line Tricks and Tips Worth Knowing

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

35 Responses

  1. ROMSAT says:

    6. (…) the rule: $ rename ‘s/\e.bak$//’ *.bak

    Other example. If you have a list of songs like this:
    $ ls -l
    01. Mecano (Grandes éxitos) – Me cuesta tanto olvidarte – http://www.radio.es.mp3
    02. Mecano (Grandes éxitos) – La fuerza del destino – http://www.radio.es.mp3
    03. Mecano (Grandes éxitos) – Hijo de la luna – http://www.radio.es.mp3
    04. Mecano (Grandes éxitos) – Cruz de navajas – http://www.radio.es.mp3
    05. Mecano (Grandes éxitos) – 7 de Septiembre – http://www.radio.es.mp3
    .
    .
    $ rename ‘s/Mecano (Grandes éxitos) – //g’ *.mp3
    $ rename ‘s/ – http://www.radio.es//g‘ *.mp3
    $
    $ ls -l
    01. Me cuesta tanto olvidate.mp3
    02. La fuerza del destino.mp3
    03. Hijo de la luna.mp3
    04. Cruz de navajas.mp3
    05. 7 de Septiembre.mp3
    .
    .

  2. incama says:

    You don’t have to do a “watch” for “tail”. Tail has his own follow option “-f”.

  3. Ed says:

    You should only use su if there is no other option, I think the correct way to accomplish clearing the log is to use sudo like this:

    sudo /bin/bash -c ‘cat /dev/null >/var/log/uptime.log ‘

    • Aaron Kili says:

      @Ed

      Point noted, i hope other Linux users have taken that into consideration as well.

    • Anonymous says:

      cat /dev/null | sudo tee /var/log/uptime.log

    • Buchan says:

      “You should only use su if there is no other option”

      What? Really, blanket sudo is worse than su.

      What is wrong with:

      su -c '> /var/log/uptime.log'
      

      (Hint: nothing)

      Regarding the solution in.the article that uses:

      $ su 
      $ sudo ...
      

      What is the purposeof the ‘sudo’? Again: nothing.

      Regarding killing processes using pidof and then kill, it can be more effecrive to use pkill (if you are unfamiliar with pkill, you van use prgrep to see which processes pkill would kill, they take mostly the same optioms).

  4. chukcha2 says:

    For #9, does using watch have any advantages to just using “tail -f”?

  5. chukcha2 says:

    Shouldn’t the first example have
    $ chmod go-rwx tecmint.info
    instead of
    $ chmod ug-rwx tecmint.info

  6. ROMSAT says:

    $ rename ‘s/\e.bak$//’ *.bak

    Other example. If you have a list of songs like this:
    $ ls -l
    01. Mecano (Grandes éxitos) – Me cuesta tanto olvidarte – http://www.radio.es.mp3
    02. Mecano (Grandes éxitos) – La fuerza del destino – http://www.radio.es.mp3
    03. Mecano (Grandes éxitos) – Hijo de la luna – http://www.radio.es.mp3
    04. Mecano (Grandes éxitos) – Cruz de navajas – http://www.radio.es.mp3
    05. Mecano (Grandes éxitos) – 7 de Septiembre – http://www.radio.es.mp3
    .
    .
    $ rename ‘s/Mecano (Grandes éxitos) – //g’ *.mp3
    $ rename ‘s/ – http://www.radio.es//g‘ *.mp3
    $
    $ ls -l
    01. Me cuesta tanto olvidate.mp3
    02. La fuerza del destino.mp3
    03. Hijo de la luna.mp3
    04. Cruz de navajas.mp3
    05. 7 de Septiembre.mp3
    .
    .

  7. ROMSAT says:

    6. (…) the rule:
    $ rename ‘s/\e.bak$//’ *.bak

    Other example. If you have a list of songs like this:
    $ ls -l
    01. Mecano (Grandes éxitos) – Me cuesta tanto olvidarte – http://www.radio.es.mp3
    02. Mecano (Grandes éxitos) – La fuerza del destino – http://www.radio.es.mp3
    03. Mecano (Grandes éxitos) – Hijo de la luna – http://www.radio.es.mp3
    04. Mecano (Grandes éxitos) – Cruz de navajas – http://www.radio.es.mp3
    05. Mecano (Grandes éxitos) – 7 de Septiembre – http://www.radio.es.mp3
    .
    .
    $ rename ‘s/Mecano (Grandes éxitos) – //g’ *.mp3
    $ rename ‘s/ – http://www.radio.es//g‘ *.mp3
    $
    $ ls -l
    01. Me cuesta tanto olvidate.mp3
    02. La fuerza del destino.mp3
    03. Hijo de la luna.mp3
    04. Cruz de navajas.mp3
    05. 7 de Septiembre.mp3
    .
    .

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 257,757
  2. 11,967
  3. 39,682

Are you subscribed?