wrap it in a function if you like...
lastfile () { ls -ltp | sed '1 d' | head -n1 }
Show Sample Output
Watch the temperatures of your CPU cores in real time at the command line. Press CONTROL+C to end. GORY DETAILS: Your computer needs to support sensors (many laptops, for example, do not). You'll need to install the lm-sensors package if it isn't already installed. And it helps to run the `sensors-detect` command to set up your sensor kernel modules first. At the very end of the sensors-detect interactive shell prompt, answer YES to add the new lines to the list of kernel modules loaded at boot. Show Sample Output
in command mode, navigate your cursor to the line where you want the command output to appear, and hit "!!". No need to enter edit mode or even type a ":" (colon).
this version is going to work on redhat/centos/suse AND ubuntu/debian systems Show Sample Output
A much quicker and (not dirtier) option. use the man page for help. On linux/ubuntu you will need to `sudo apt-get -y install arp-scan`. Show Sample Output
So your boss wants to know how much memory has been assigned to each virtual machine running on your server... here's how to nab that information from the command line while logged in to that server Show Sample Output
just a bit simpler
see http://iptraf.seul.org/ for all kinds of documentation and screenshots
*as long as the drives are exactly the same* then this command copies the partition table on /dev/sda to /dev/sdb
Send it the easy way, with MIME and everything handled for you by an app that knows best.
-B flag = don't include characters that can be confused for other characters (this helps when you give someone their password for the first time so they don't cause a lockout with, for example, denyhosts or fail2ban)
-s flag = make a "secure", or hard-to-crack password
-y flag = include special characters (not used in the example because so many people hate it -- however I recommend it)
"1 10" = output 1 password, make it 10 characters in length
For even more secure passwords please use the -y flag to include special characters like so:
pwgen -Bsy 10 1
output>> }&^Y?.>7Wu
Show Sample Output
download the denyhosts-remove script from http://www.atrixnet.com/remove-an-ip-address-ban-that-has-been-errantly-blacklisted-by-denyhosts/
conversely, you can type
flip -m
to convert the file back to MS line endings.
plays with bash arrays. instead of storing the list of files in a temp file, this stores the list in ram, retrieves the last element in the array (the last html file), then removes it.
Converts a .vdi file to a .vmdk file for use in a vmware virtual machine. The benefit: using this method actually works. There are others out there that claim to give you a working .vmdk by simply using the qemu-img command alone. Doing that only results in pain for you because the .vmdk file will be created with no errors, but it won't boot either. Be advised that these conversions are very disk-intensive by nature; you are probably dealing with disk images several gigabytes in size. Once finished, the process of using the new .vmdk file is left as an exercise to the reader. Show Sample Output
same, except it works on any OS with Perl installed. DOS, Windose, whatever
After this, just type:
beepwhenup
You need to install "beep" before this would make the beep sound.
Save it in your .profile if you want to use it later
WARNING: this command won't exit until it is successful. You won't be able to CONTROL+C out of it.
http://en.wikipedia.org/wiki/Universally_Unique_Identifier http://www.ossp.org/pkg/lib/uuid/ You'll first need to install the uuid package. Available immediately from apt in Ubuntu, Debian, or other myriad Debian variants. You could always compile it from source as well. Show Sample Output
Use `zless` to read the content of your *rss.gz file:
zless commandlinefu-contribs-backup-2009-08-10-07.40.39.rss.gz
Show Sample Output
A similar command that lists only the currently running VMs is thus:
VBoxManage list runningvms
...the above showing a list of VMs by name and UUID in the same format as the "$ VBoxManage list vms" command
Show Sample Output
you can launch a VirtualBox VM from the command line using VBoxManage, but that invokes it in a gui environment.
If you want to just fire off your VM in the background, use VBoxHeadless as shown. To get the names and UUIDs of your VirtualBox VMs, type:
VBoxManage list
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.
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
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: