Live data from Hacker News

What's the one Linux command you wish you knew years ago?

reddit.com

191–200 of 216 posts

Re: What's the one Linux command you wish you knew years ago?

#191

Earlier quoted context omitted.

Which according to reports has the benefit of being maintainable. GNU screen, which I love and use to obscene extents daily, has an exceptionally hairy codebase. That said, I've got to get my tmux on and learn how to do screen equivalents with it.... http://www.techrepublic.com/blog/opensource/is-tmux-the-gnu-...

I keep seeing people comment on the codebase of screen being bad vs tmux, but I'm not sure why that is an issue? Are there any features of screen missing that haven't been added to the codebase? The vertical split patch has been added a long while back, and even though I'm sure tmux has a smaller memory footprint, I've never had an occasion where screen has ever been an app I'm worried might impact my server memory u…

Yes. screen will not run in terminals with long names, like rxvt-unicode-256color. This is due to a fixed-length buffer for storing the terminal name. Simple solution: make the buffer bigger. I did that and submitted the patch to Debian and upstream, and last I looked, it was still broken. I switched to tmux and never looked back.

OK, I looked back and it's fixed now: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=621804. 6 months is a long time to wait. (Not that I'm criticizing Debian. It would never be fixed if it wasn't for the distributions patching it.)

Re: What's the one Linux command you wish you knew years ago?

#193
post #143
post #141

Earlier quoted context omitted.

Is tmux as available as screen? I often have to fix servers that are not from own group, so all my knowledge is honed around tools that i can find anywhere.

Perhaps not, but tmux's bindings are nearly all backwards-compatible with screen's. Well, the default escape char is ctrl-B but I (and I think most folks) just remap it to ctrl-A immediately.

Crtl-Z, you mean. Ctrl-A is for start of line in bash and emacs, so that won't do

Re: What's the one Linux command you wish you knew years ago?

#194

Actually the new top comment blew me away. I'm in the 20 year veteran category and was also oblivious. Quoted: disown - bash built in. You know how you always start that mega long rsync in an ssh session from your laptop and then realize you have to go offline halfway through? You forgot to start it in screen or nohup, didn't you? You can pause it (ctrl+z), background it (bg), and then disown it so it is protected fr…

Didn't know about disown, I always just did an "exec $SHELL" in this case.

Could someone explain what this would accomplish? If you have to go offline you would still lose that session, no?

Re: What's the one Linux command you wish you knew years ago?

#195

This is useful for finding and killing a process. ps -A | grep some text in program name upon getting the pid kill -9 pid

Instead of kill -9 (a nuke), you can often get results with just kill, kill -INT or kill -HUP. (The advantage is that the "weaker" signals allow your runaway program to do some cleanup, but kill -9 doesn't.) There's a nice write-up and a function automating attempts to run increasingly strong signals on this site: http://web.archive.org/web/20080610070315/http://sial.org/ho... (Thank god for the wayback machine. That…

It's still there, just without a domain:

http://72.14.189.113/

Re: What's the one Linux command you wish you knew years ago?

#196
post #52
post #24

That reddit thread is delightful, because it is full of wonderful commands that I didn't know, or rarely use, or had forgotten. But it's also terrifying, because it exposes how many people will post questions before using man.

Many comments seem to be shell- and bash-related. Perhaps the thread exposes how difficult to read the bash manpage is. On my system, the bash 4.1 manpage is 41026 words long, or about 80 pages. Manpages are most useful to me when they are short and to-the-point so I can find what I am looking for before I lose interest in skimming through an 80 page book.

On my MacBook the manpages scroll hellishly slow and there are no "Page Down" keys (maybe there is some key combo? I don't know). I end up googling for the manpages on the web instead most of the time...

Re: What's the one Linux command you wish you knew years ago?

#197
I wonder, how do you remember all the command line options?

Recently I had this thought: maybe those people who can remember the options actually are autistic (don't know the proper word, that thing many geeks are deemed to be), and I am not. Remembering command line options might be like knowing large prime numbers within seconds.

But I am also interested in memory techniques like the Loki method. Perhaps some good system for memorizing command line arguments could be devised...

Re: What's the one Linux command you wish you knew years ago?

#198
post #6

Earlier quoted context omitted.

Never thought to use ``. I always used xargs: find . -name *.java | xargs cat | wc -l

Dollar-paren expansion beats backticks for being nestable. E.g.: I like dumping temporary files with timestamps: some-command-to-generate-log > /tmp/log-$( date +%Y%m%d-%H%M%S ) Now, if I want to wrap that in a larger loop -- say, iterating over a number of files or parameters: command $( expansion one $( expansion 2 )) Works With backticks you'd have to do escapes: command `expansion 1 \`expansion 2\` ` ... which ge…

I like to use (for GNU date at least): $ date -Iseconds 2011-11-21T10:56:17+0000

because it requires less typing. The ISO 8601 standard format.

-Is, -Im, -Ih, and -Id allow you to change the displayed resolution.

Bizarrely, this doesn't seem to be documented in my version of date (coreutils 8.10).

Re: What's the one Linux command you wish you knew years ago?

#200
post #196
post #52

Earlier quoted context omitted.

Many comments seem to be shell- and bash-related. Perhaps the thread exposes how difficult to read the bash manpage is. On my system, the bash 4.1 manpage is 41026 words long, or about 80 pages. Manpages are most useful to me when they are short and to-the-point so I can find what I am looking for before I lose interest in skimming through an 80 page book.

On my MacBook the manpages scroll hellishly slow and there are no "Page Down" keys (maybe there is some key combo? I don't know). I end up googling for the manpages on the web instead most of the time...

On the MacBooks I've seen, Page Up/Down is usually Fn+Up Arrow/Fn+Down Arrow. I don't know if this is implemented in software or hardware, though, so if you're running *nix, you might be out of luck.
Post reply on HN