All Tips


418

Tip #46  

Using expansion to move a file aside without having to type the file name twice

Read more »

311

Tip #26  

Running a second command with the same arguments as the previous command, use '!*' to repeat all arguments or '!:2' to use the second argument. '!$' uses the final argument.

Read more »

261

Tip #107   Use history to SUDO last command

Forget that your running as underprivileged? No need to retype the command.

> command_with_insufficient_permissions
Permission denied

> sudo !! Read more »

232

Tip #77   Bash fork bomb

Don't forget the bash fork bomb. DO NOT TRY THIS AT HOME... Posted here so that you don't see this in a forum or a mailing list and use it without knowing:

Read more »

199

Tip #24  

Don't search history by grepping ~/.bash_history, or repeatedly hitting the up arrow, instead use CTRL+r (or '/' in vi-mode) for search-as-you type. You can immediately run the command by pressing Enter. Read more »

183

Tip #21  

Place a filename at the beginning of the line to make it easier to edit the search at the end of the command.

Read more »

165

Tip #185   CDPATH

This is a little known and very underrated shell variable. CDPATH does for the cd built-in what PATH does for executables. By setting this wisely, you can cut down on the number of key-strokes you enter per day.

For example:
Read more »

110

Tip #275   Get an ordered list of subdirectory sizes

This piece of code lists the size of every file and subdirectory of the current directory, much like du -sch ./* except the output is sorted by size, with larger files and directories at the end of the list. Useful to find where all that space goes.

Read more »

108

Tip #45  

multiple command output into a single program:

diff -u <(ls -c1 dir_1) <(ls -c1 dir_2)

Will show you a diff of files in the root of dir_1 and dir_2 Read more »