Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all,
Vanilla are planning an update to the site on April 24th (next Wednesday). It is a major PHP8 update which is expected to boost performance across the site. The site will be down from 7pm and it is expected to take about an hour to complete. We appreciate your patience during the update.
Thanks all.

Command line tips & tricks

124»

Comments

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


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


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


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


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


    cat a file backwards... use tac command


  • Registered Users Posts: 883 ✭✭✭Keplar240B




  • Registered Users Posts: 723 ✭✭✭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 Posts: 1,931 ✭✭✭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 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 Posts: 70 ✭✭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