Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Command line tips & tricks

124»

Comments

  • Registered Users, Registered Users 2 Posts: 2,430 ✭✭✭RebelButtMunch


    Want to answer 'n' to lots of repetitive questions? Use the YES command
    e.g.
    "yes n | gzip -d *"


  • Registered Users, Registered Users 2 Posts: 2,430 ✭✭✭RebelButtMunch


    Want to answer 'n' to lots of repetitive questions? Use the YES command
    e.g.
    "yes n | gzip -d *"


  • Registered Users, Registered Users 2 Posts: 2,430 ✭✭✭RebelButtMunch


    cat a file backwards... use tac command


  • Registered Users, Registered Users 2 Posts: 887 ✭✭✭Keplar240B




  • Registered Users, Registered Users 2, Paid Member Posts: 748 ✭✭✭Dero


    One thing that (irrationally) bugs me is seeing "grep -v grep"; e.g.
    ps -ef | grep java | grep -v grep
    

    So I use this character class trick that someone showed me years ago:
    ps -ef | grep [j]ava
    

    It'll also work anywhere else that regex can be used, like awk:
    ps -ef | awk '/[j]ava/ {print $2}'
    

    Yes, pgrep will do this, but I work a lot on AIX, which doesn't have pgrep.

    Also, for parallel execution, you can use xargs and nproc if parallel is not installed/available.
    ls -1 *.flac | xargs -P $(nproc) -n1 -I{} oggenc "{}"
    

    Using nproc will match the number of logical CPUs in your machine, but you could use more or less if you want.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,929 ✭✭✭PrzemoF


    $ cat a
    A
    B
    C
    D
    $ cat b
    1
    2
    3
    4
    $ paste a b
    A   1
    B   2
    C   3
    D   4
    

    Nothing really special about it, but it just saved me some work :-)


  • Registered Users, Registered Users 2 Posts: 83 ✭✭rayzercork


    if you have the xfce terminal installed type

    xfce4-terminal --drop-down

    and it will drop down from the top of your screen. if you create a launcher with that command and stick it into usr/share/applications you can run it from the menu or else assign a keyboard shortcut like F12 to activate it.
    i like to run cmus music player inside this terminal because i can hide it out of the way when not needed


  • Registered Users, Registered Users 2 Posts: 71 ✭✭lyda


    If you want to version control your home directory, look at vcsh: https://github.com/RichiH/vcsh

    It's also available in most distros. The nice part is that you can put different parts of your home dir in different repos.



Advertisement