Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: What's one Linux command you wish you'd learned years ago?
18 points by yarapavan on July 18, 2020 | hide | past | favorite | 20 comments


sed, awk or even the fact that I could've used perl from command line

    sed -i 's/old/new/g'
alone would have saved me lot of time instead of fiddling with a perl script everytime

Also, I would've liked to understand shell concepts like file redirections, command substitution, parameter expansion, difference between stdout/stderr, why sometimes I got an error for too many file arguments, or even knew that there existed sites like https://mywiki.wooledge.org/BashFAQ and stackoverflow/unix.stackexchange and https://www.shellcheck.net/ and https://explainshell.com/ and so on.


Just as an addition to the OP comment: "perl -pe 's/old/new/g'" is the perl pendant for sed. The obvious advantage is the support for Perl regexes. Also there's the "-r" switch for sed which extends Regexes compatibility.


fzf as command history search, coupled with an unlimited history file. It is by far my “unfair advantage”, I do things so much faster than my coworkers...


As someone who massively use Ctrl+r and history|grep, I don't get it. Can you elaborate, with examples if possible?


Tmux and Vim for me - they are tools and not exactly commands.


^R in bash to search command history.


This comes from readline, and there are many many useful shortcuts. For example "M-." (i.e. "Escape", then ".") to insert the last argument of the previous command.

This is great when you run something like:

      ls /path/to/foo
      cd M-.


Similarly I knew about Ctrl+U delete from cursor to beginning of line but learned of (or had forgotten about) Ctrl+K delete from cursor to end of line many years later.


Xargs or awk


watch command


man


:q


Awk.


find ... -exec ... {}\;


pushd popd cd -


shutdown :)


poweroff


tac


sed, tr.


tailf




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: