du -sh ./D* 872K ./Desktop 78M ./Documents 3.2G ./Downloads
I would add | sort -h here
What's the one Linux command you wish you knew years ago?
101–110 of 216 posts
Re: What's the one Linux command you wish you knew years ago?
#102Earlier quoted context omitted.
Either that or rename jpg png /path/to/some/file.jpg
I didn't know you could do that with rename. I would have done rename 's/jpg/png/g' /path/to/some/file.jpg
I prefer the regex one, of course, especially since it takes proper Perl regexes :)
You have to be careful of this though and probably avoid using this command in shell scripts.
edit: You can just stick Debian's rename at $HOME/bin/rename.pl and call it a day; this command is useful in the terminal since it's less typing than a for loop.
Re: What's the one Linux command you wish you knew years ago?
#103Actually 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…
You will be pleased to know that there is a site full of little gems like this: http://www.commandlinefu.com/commands/browse/sort-by-votes Most of my time savers that I've never thought of were found there.
Love this one.
Re: What's the one Linux command you wish you knew years ago?
#104100% agree with CTRL-R. It changed my life. Others that I love: screen, pdsh, perl -pi -e 's/find/replace/g' *.txt redis-cli's new ability to have piped in data be the last argument of a command. vim -o file1.txt file2.txt file3.txt (opening multiple files with vim) Using vim instead of less as a pager: cat file.txt | vim -
Unless you only use GPL software, there's no reason to not use tmux these days. Well, maybe if you're on HP-UX or something.
Re: What's the one Linux command you wish you knew years ago?
#105My method to learn Linux/OSX command line. Step 1: Think "I wish I could do X." Step 2: Google/duckduckgo "How to do X in bash" Step 3: Delight that a simple solution already exists. This method is successful in 95% of all cases.
Re: What's the one Linux command you wish you knew years ago?
#106Passes last argument on the command line. In general, the whole paragraph on HISTORY EXPANSION in the bash manual is a must read.
A few ones from the moreutils package:
- vipe : manually edit the data in the middle of a pipe.
- vidir : treat a directory and its files as a text file. Does renames and deletions.
- sponge : when you're doing modification on a file in a pipe, and want the output to be to this file (file will be scrambled without sponge).
It has others, very useful tools, but I won't spoil them all.
Re: What's the one Linux command you wish you knew years ago?
#107100% agree with CTRL-R. It changed my life. Others that I love: screen, pdsh, perl -pi -e 's/find/replace/g' *.txt redis-cli's new ability to have piped in data be the last argument of a command. vim -o file1.txt file2.txt file3.txt (opening multiple files with vim) Using vim instead of less as a pager: cat file.txt | vim -
http://www.vim.org/scripts/script.php?script_id=1723 vimpager. Set vim as your pager. I love reading man pages in syntax-colored vim glory.
Re: What's the one Linux command you wish you knew years ago?
#108Earlier quoted context omitted.
The OP's example is diffing listings of the two directories whereas your command is asking diff to directly work on the directories themselves.
Which means for example you could get that listing in any format, so you could for example spot changes in permissions or ownership if you included it in the listing.
Re: What's the one Linux command you wish you knew years ago?
#109100% agree with CTRL-R. It changed my life. Others that I love: screen, pdsh, perl -pi -e 's/find/replace/g' *.txt redis-cli's new ability to have piped in data be the last argument of a command. vim -o file1.txt file2.txt file3.txt (opening multiple files with vim) Using vim instead of less as a pager: cat file.txt | vim -
Did you know that Ctrl-s will search forwards through the history too? You'll have to switch flow control off first.
Re: What's the one Linux command you wish you knew years ago?
#110That 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.