Commands tagged bash (821)

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Rename files in batch

list block devices
Shows all block devices in a tree with descruptions of what they are.

Bash alias to output the current Swatch Internet Time
Output the current time in Swatch “Internet Time”, aka .beats. There are 1000 .beats in a day, and @0 is at 00:00 Central European Standard Time. This was briefly a thing in the late 1990s. More details: https://2020.swatch.com/en_ca/internet-time/ The alias is rather quote heavy to protect the subshell, so the bare command is: $ echo '@'$(TZ=GMT-1 date +'(%-S + %-M * 60 + %-H * 3600) / 86.4'|bc)

View a colorful logfile using less

Terminal redirection
Will redirect output of current session to another terminal, e.g. /dev/pts/3 Courtesy of bassu, http://www.commandlinefu.com/commands/by/bassu

Use QEMU to create a hardware dual-boot without rebooting
After downloading an ISO image, assuming you have QEMU installed, it’s possible to boot an ISO image in a virtual machine and then install that ISO from within the virtual machine directly to a physical drive, bypassing the need to reboot. Simply pass the ISO image as the -cdrom parameter, followed by “format=raw,file=/dev/sdb” (replace /dev/sdb with the drive you want to install to) as the hard drive parameter (making absolutely certain to specify the raw format, of course). Once you boot into the ISO image with QEMU, just run the installer as if it were a virtual machine — it’ll just use the physical device as an install target. After that, you’ll be able to seamlessly boot multiple distros (or even other operating systems) at once.

Change wallpaper

Selecting a random file/folder of a folder
Also looks in subfolders

move up through directories faster (set in your /etc/profile or .bash_profile)
You can also remove the "&& pwd" if you don't want it to print out each directory as it moves up.

Scrollable Colorized Long Listing - Hidden Files Sorted Last
To sort hidden files first, simply switch the two inner `ls` commands. I have this aliased to `dira` `dir` is aliased to the simpler version with no hidden files: $ ls -l --color=always | less -R


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: