frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Discuss – Do AI agents deserve all the hype they are getting?

4•MicroWagie•4h ago•1 comments

Ask HN: Anyone Using a Mac Studio for Local AI/LLM?

48•UmYeahNo•1d ago•30 comments

LLMs are powerful, but enterprises are deterministic by nature

3•prateekdalal•8h ago•6 comments

Ask HN: Non AI-obsessed tech forums

29•nanocat•19h ago•26 comments

Ask HN: Ideas for small ways to make the world a better place

18•jlmcgraw•21h ago•21 comments

Ask HN: 10 months since the Llama-4 release: what happened to Meta AI?

44•Invictus0•1d ago•11 comments

Ask HN: Who wants to be hired? (February 2026)

139•whoishiring•5d ago•520 comments

Ask HN: Who is hiring? (February 2026)

313•whoishiring•5d ago•514 comments

Ask HN: Non-profit, volunteers run org needs CRM. Is Odoo Community a good sol.?

2•netfortius•16h ago•1 comments

AI Regex Scientist: A self-improving regex solver

7•PranoyP•23h ago•1 comments

Tell HN: Another round of Zendesk email spam

104•Philpax•2d ago•54 comments

Ask HN: Is Connecting via SSH Risky?

19•atrevbot•2d ago•37 comments

Ask HN: Has your whole engineering team gone big into AI coding? How's it going?

18•jchung•2d ago•13 comments

Ask HN: Why LLM providers sell access instead of consulting services?

5•pera•1d ago•13 comments

Ask HN: How does ChatGPT decide which websites to recommend?

5•nworley•1d ago•11 comments

Ask HN: What is the most complicated Algorithm you came up with yourself?

3•meffmadd•1d ago•7 comments

Ask HN: Is it just me or are most businesses insane?

8•justenough•1d ago•7 comments

Ask HN: Mem0 stores memories, but doesn't learn user patterns

9•fliellerjulian•2d ago•6 comments

Ask HN: Is there anyone here who still uses slide rules?

123•blenderob•4d ago•122 comments

Kernighan on Programming

170•chrisjj•5d ago•61 comments

Ask HN: Anyone Seeing YT ads related to chats on ChatGPT?

2•guhsnamih•1d ago•4 comments

Ask HN: Does global decoupling from the USA signal comeback of the desktop app?

5•wewewedxfgdf•1d ago•3 comments

Ask HN: Any International Job Boards for International Workers?

2•15charslong•18h ago•2 comments

We built a serverless GPU inference platform with predictable latency

5•QubridAI•2d ago•1 comments

Ask HN: Does a good "read it later" app exist?

8•buchanae•3d ago•18 comments

Ask HN: Have you been fired because of AI?

17•s-stude•4d ago•15 comments

Ask HN: Anyone have a "sovereign" solution for phone calls?

12•kldg•4d ago•1 comments

Ask HN: Cheap laptop for Linux without GUI (for writing)

15•locusofself•3d ago•16 comments

Ask HN: How Did You Validate?

4•haute_cuisine•2d ago•6 comments

Ask HN: OpenClaw users, what is your token spend?

14•8cvor6j844qw_d6•4d ago•6 comments
Open in hackernews

Ask HN: What are your favorite one-liner shell commands you use?

23•rajkumarsekar•6mo ago
There are plenty of lists online with fancy or obscure one-liners, but I’m curious about the ones people actually use day to day.

Comments

TheNewAndy•6mo ago
Not really a shell one liner, but ctrl+r (a readline command to do an incremental search backwards through history) is something that has been present on every shell I've used for decades without realising it, One day I decided to take the time to read all the magic readline commands because I wanted a way to quickly edit the N-th argument of a command with lots of arguments, and there were way too many of them. There were so many commands that I had no hope of remembering them all, but I figured I could just remember a few useful ones - and ctrl+r was one of them (ctrl+w and alt+b were the other two)

More to the letter of the question, I use "cd -" frequently, "ps -e | grep some_process_i_would_like_the_pid_for", and while I don't use it frequently, I didn't know about "ssh-copy-id" for a long time, and would do it manually with a text editor in the past. Sorry if they are not sufficiently fancy - but for things to get used day to day for me, they will need to be short and sweet.

vinhnx•6mo ago
I also same here. Has since I discovered Ctrl+R, and equipped it with fzf (https://github.com/junegunn/fzf), every terminal command is in my hand, I can fuzzy search and not need to remember the exact command. This really saved me a lot of times.
scrapheap•6mo ago
`cd -` is great for when you just want to nip out of your current directory for a second and then come straight back - especially as I'm pretty sure that most of us never think about pushd/popd until after we've moved to the other directory with cd :)
000ooo000•6mo ago
Semi-related: if I want to do a little side quest, maybe pop over to another repo or git worktree for a quick look, I'll drop into a subshell just by running bash before cd-ing. Then I just exit that shell (alias q=exit) when I want to return back to the original dir and context.
scrapheap•6mo ago
You know that you can just press <CTRL+D> at the bash prompt to quit it as well? (In fact <CTRL+D> will quit out of most command line programs as it's the End Of Transmission character)
rajkumarsekar•6mo ago
No need to be fancy. These are super practical! ctrl+r is a lifesaver once it clicks, and cd - is such a small thing that makes moving around so much smoother.
willprice89•6mo ago
dd if=/dev/zero bs=1M count=10 | nc -N -l -p 12345

Great simple test for network speed on a box without speedtest-cli or other tools installed.

jauco•6mo ago
I rarely use the exact samme command multiple times. But here are some bash pipe segments I enjoy.

using pv (pipeviewer) instead of cat to get a progress bar when grepping huge files.

Using httpie instead of curl so I can remember the flags.

The power of find -exec to run commands on a lot of specific files. The nice part is you can run it without exec first to see if you have the right set of files.

If you do a loop you can echo -e “$somevar\r” and then each write will overwrite the previous line so you screen doesn’t fill up but you do get a feel for the progress (to make it nice you need to pad with spaces, google for echo carriage return to learn more)

scrapheap•6mo ago
Find's -exec option is great when you need to automate removing old backups
gaws•6mo ago
> using pv (pipeviewer) instead of cat to get a progress bar when grepping huge files.

How does this work?

jauco•6mo ago
This seems to be a nice introduction:

https://www.geeksforgeeks.org/linux-unix/pv-command-in-linux...

gaws•6mo ago
I'm curious about your use of `pv` with `cat` and `grep` on large files.
rajkumarsekar•6mo ago
Some great power tips here, especially love the pv + grep combo for big files.
xiconfjs•6mo ago
:(){ :|:& };:
yjftsjthsd-h•6mo ago
Do you, ah, find yourself using that a lot?:)
xiconfjs•6mo ago
How else can I make use of my 16-core laptop processor?
AnonHP•6mo ago
This is an “I need a long coffee break” command, right?
xiconfjs•6mo ago
It‘s a „Mr. Computer-Man please help - my computer isn‘t working“ command :)
geocrasher•6mo ago
Daily, and with enough general usability to share? I have a few. They are basic. You can probably figure out what industry I work in.

    df -h /; echo "----"; for fattable in $(find /var/lib/mysql/ -name *.ibd -size +1G -exec ls -lh {} \; | awk '{ print $9 }' );do echo BEFORE " " $(ls -lh $fattable| awk '{ print $5" " }'); db=$(echo $fattable| cut -d/ -f5); otable=$(echo $fattable| cut -d/ -f6| cut -d. -f1); echo mysql -qbse \"use $db \; optimize table  $otable\;\"|bash;echo AFTER" "" " $(ls -lh $fattable| awk '{ print $5" " }');echo "----" ;done; echo "----"; df -h /

    apachectl fullstatus | grep ^[0-9]| awk '{ print $12" "$14 }' | sort | uniq -c| sort -n |tail

    
    tail -100000 /var/log/nginx/access.log | sed "/$(hostname -i)/d" | awk '{ print $1" "$7 }' | sort | uniq -c | sort -n | tail -050


    find . -mtime -1 | cut -d/ -f2 |uniq

  
    pkill lsphp; sleep 2; while true; do sleep .4; strace -p $(ps aux | grep [i]ndex| awk '{ print $2 }' | head -01); done


    for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file 2>/dev/null; done| awk '{ print $2" "$3" "$1 }'  | sort -n | tail -20


    find . -size +200M -exec ls -lh {} \; | awk '{ print $5" "$9 }' 


    awk '{ print $4 }' 

https://explainshell.com/
bravesoul2•6mo ago
Some kinda shared hosting?
geocrasher•6mo ago
yes, on the high end of things :)
rajkumarsekar•6mo ago
That’s an impressive collection. Definitely not basic! Love how practical these are for real-world ops work, especially the MySQL .ibd optimizer loop and swap memory check.
scrapheap•6mo ago
This one gets uses a lot to compare two versions a JSON file

  vimdiff <( jq < /tmp/file1.json ) <( jq < /tmp/file2.json )
samgutentag•6mo ago
I have had the alias `huh` for years, which is just `pwd; whoami` just to confirm I am where I think I am, and I am who I think I am
andrei_says_•6mo ago
Naming things is hard and this one is perfect.
rajkumarsekar•6mo ago
That’s clever and oddly reassuring.
000ooo000•6mo ago
I have a super neat one but it's on my work machine. Not strictly a one-liner but definitely a CLI QoL improvement. It allows me to type a partial command, for e.g. up to where a file path might be, hit a hotkey to invoke (e.g.) fzf, and finally have fzf's output inserted where my cursor was in the command. Uses some vars that readline exposes. I haven't taken it beyond inserting paths yet, but you could imagine you could do a lot with inserting arbitrary output into a command you are midway through typing. I'll reply to this when I have it on hand.
sshine•6mo ago
> but it's on my work machine

Install Tailscale on your machines, and your work machine is always just one ssh command away.

000ooo000•6mo ago
I am not allowed to install legitimate development tools..
AnonHP•6mo ago
Defined this in whatever init script the shell uses so that I get a long listing of files (first alias below) and long listing of files sorted from oldest to newest (second alias below):

alias ll=“ls -l”

alias lln=“ls -lrt”

Apart from this, I have a few aliases defined to get the size of specific folders and their subfolders (using ‘du -h’ for human readable sizes). The aliases are named like “duh”, “dut” and so on.

jjgreen•6mo ago
All files in this git repository containing the string "foo"

    git grep foo | cut -d: -f1 | uniq
sshine•6mo ago
Using ripgrep,

  rg -l foo | uniq
PeterWhittaker•6mo ago
git grep -l foo | sort -u
rramadass•6mo ago
1) Whenever building anything;

<make/build script> 2>&1 | tee build.log | grep <whatever>

2) Do everything within GNU Screen window with CTRL-A + Shift-H to log all output to logfile i.e. "screenlog.<window num>".

Both lifesavers when working with multiple systems and codebases.

3) Always use "set -o vi" with bash so that i can use vi/vim keybindings across everything.

lozf•6mo ago
> GNU Screen window with CTRL-A + Shift-H to log all output to logfile

tmux users can use it's `capture-pane` command, either before or after the fact if history is set big enough. There are several helpful flags worth researching.

e.g. `tmux capture-pane -pS - > ~/tmux.log` in a shell to save the history of that pane, or just `prefix+: capture-pane ...` from within tmux

bravesoul2•6mo ago
Boring but

docker ps

docker kill

git switch

git commit

git push

rajkumarsekar•6mo ago
Not boring at all. These are the real “daily drivers” that keep things moving.
peter-m80•6mo ago
alias untar='tar -zxvf'
tmaly•6mo ago
I use pgrep -fl <name> instead of ps to find running processes by name.

For complex one liners, I keep them in a simple txt file with a brief description so I can find them later when I need to use them again.

rajkumarsekar•6mo ago
Smart move with pgrep -fl—so much cleaner than piping through ps | grep. And keeping a personal cheat sheet of one-liners is underrated.
UI_at_80x24•6mo ago
Want the HTTP status code for a server?

```alias hstat="curl -Lo /dev/null --silent --head --write-out '%{http_code}\n'" $1 #HTTP status code```

example:

```$ hstat google.com 200```

noperator•6mo ago
kind of meta, but one of my most-used commands is sol: a de-minifier (formatter, exploder, beautifier) for shell one-liners

https://github.com/noperator/sol