NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
Ask HN: What are your top most useful Unix commands?
DrScump 1630 days ago [-]
kill lets you send any signal to a process you have control over. Corresponding signal handlers allow a wide range of behavior changes.
ksaj 1629 days ago [-]
A lot of people only know about its use for literally killing a process. But as an example of where I find myself using it fairly often is:

kill -USR1 <dd>

where <dd> is the process ID (obtained from ps) for the dd command.

Instead of killing dd, it reports back how much has been read/copied so far. Especially useful for working with large files and you decide you want to guestimate how much longer the copy will take.

simonblack 1630 days ago [-]
ls, find, grep, tar, cpio

But in truth, it's the bash scripting 'glue' that holds everything together.

kleer001 1630 days ago [-]
the semicolon ";" for chaining commands

ls -l

the "alias" command in a file for setting up quick-commands

antoineMoPa 1631 days ago [-]
grep, find, tail -f (useful to look at log files as they update)

Extras: sort, uniq, sed, sftp, apropos, man

jjjbokma 1630 days ago [-]
tail -F

This will also follow a log file if it rotates.

jolmg 1630 days ago [-]
I just found out a few days ago that `-F` works with multiple files, too. When there's new content on one, tail prefixes the output with a header, telling you what file it is.

I've used that to watch all logs apache and descendant processes could be writing to:

  pstree -p $(pgrep -o apache2) \
  | grep -Po '[^}]\(\K\d+'
  | sed ':b;N;$!bb;s/\n/,/g' \
  | sudo xargs lsof -d 0-1000 -a -p \
  | grep -Po '\S+$' \
  | grep 'log' \
  | sort -u \
  | xargs tail -F
apotatopot 1631 days ago [-]
top

jk, but also not.

w !sudo tee % in vim, even tho that's not really directly a unix thing?

potta_coffee 1631 days ago [-]
history | grep <command halfway remember using>
0x445442 1631 days ago [-]
dirs -v pushd popd
wbsun 1631 days ago [-]
cd pwd ls
runjake 1630 days ago [-]
cut, awk, sed, comm, grep
jolmg 1630 days ago [-]
git
sgillen 1630 days ago [-]
emacs&
jjjbokma 1631 days ago [-]
find, grep
hntddt1 1631 days ago [-]
ls
chmielewski 1631 days ago [-]
time cat
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 08:39:20 GMT+0000 (Coordinated Universal Time) with Vercel.