Commands by hvnsweeting (0)

  • bash: commands not found

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

Check for Firewall Blockage.
This is just one method of checking to see if an IP is blocked via IP tables or CSF. Simple and to the point. Replace xx.xx.xx.xx with the IP you wish to check.

detect partitions
`blkid` is an interface to libuuid - it can read Device Mapper, EVMS, LVM, MD, and regular block devices. -c /dev/null - Do not use cached output from /etc/blkid.tab or /etc/blkid/blkid.tab (RHEL) -i - Display I/O Limits (aka I/O topology) information (not available in RHEL) -p - Low-level superblock probing mode (not available in RHEL)

Print only the odd lines of a file
NR%2 == 1 on odd lines and 0 on even lines

list block level layout

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

Simple complete system backup excluding files or directories
You can exclude more system folders or individual files which are not necessary for the backup and can be recreated after the restore procedure, like /lost+found, /mnt, /media, /tmp, /usr ... Restoring the above backup procedure is as simple as becoming root and typing: $ tar zxpf backup.tgz -C / You can extract any file or directory out of the backup.tgz file for recovery, for instance, if you have a corrupt or mis-configured fstab file, you could simply issue the command: $ tar zxpf backup.tgz /ect/fstab -C / Other options: v add verbose option to see files processed A far safer solution is to restore the desired files under a different directory, and then compare, move, or update the files to their original locations afterward.

Displays the number of unread messages on your gmail at the top right corner of your terminal
Checks your gmail account every 30 seconds and display the number of new messages in the top right corner of the terminal. A kind of CLI "Gmail notifier" if you will. :-) This is a mashup of http://www.commandlinefu.com/commands/view/7916/put-a-console-clock-in-top-right-corner and http://www.commandlinefu.com/commands/view/3386/check-your-unread-gmail-from-the-command-line

Convert A USB Cable Into A Smart Home Gadget
An old USB A/B cable is all you need to make your own Smart Home hardware! Cut off and discard the B-portion of the USB cable. On the A side, connect the RED (+) and WHITE (D-) wires via a 1 kiloohm resistor. $Picture: http://imgur.com/dJGVlAU Now plug the cable into a USB port on your Linux computer. Your hardware is ready! Run the above command after changing variable mysms to your personal email-to-SMS gateway info as required by your cellular service provider. The command uses the amazing usbmon tool (see link below) to detect the cable. For the curious, to view the raw usbmon output, run this command: (Also see the sample output) $usbmon -i usb0 How does it work? When the red and white wires are connected (via the 1 kiloohm resistor) the USB hardwere is tricked into thinking that a new USB device is trying to start up. We then use the usbmon utility to capture the host USB events as it tries to talk to the cable. The expect utility watches the usbmon stream and waits for the disconnect text "-2:128" before sending the SMS message. Finally, the sendmail tool is used to email the SMS message to your smartphone via your cellular provider's SMS-to-email gateway. As a result, when the electrical connection between the red and white wire is interrupted, or the USB cable is unplugged from your computer, you get an SMS notification of the disconnect event on your smartphone. Could this be the cheapest smart home gadget ever? What are YOU going to sense with it? Please let me know in the comments and please don't forget to click it up! $ $Links: $ http://www.linuxcertif.com/man/8/usbmon/ http://en.wikipedia.org/wiki/USB#Pinouts http://imgur.com/dJGVlAU

Create POSIX tar archive
tar(1) and cpio(1) are not fully platform agnostic, although their file formats are specified in POSIX.1-2001. As such, GNU tar(1) might not be able to extract a BSD tar(1) archive, and ivce versa. pax(1) is defined in POSIX.1-2001. To extract an archive: $ pax -rf archive.tar

convert unixtime to human-readable


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: