Linux Commands To Play With[Part1]
The most powerful scenario where Linux shines is the command shells, commands & it’s combination.Not to say more on it’s advantage but try here some sample tricks/commands , which you might be knowing/not.So take back control with some of these command-line gems.
- Make a PDF out of a command’s manual page (which can be much easier to read):You could find the pdf in home folder
man -t command | ps2pdf – filename.pdf
- Force a disk check at the next boot, rather than waiting for every 30 reboots
(sudo -s first): >/forcefsck :The presence of ‘forcefsck’ in the root of a filesystem will tell Ext2/3/4 to check, the use of ‘>’ creates an empty file. The file will be removed automatically
- Check your battery life on the laptop: grep -F capacity: /proc/acpi/battery/BAT0/info
- Back up your hard disk, to a remote machine, over the network, securely, and compress it on the fly:
dd bs=1M if=/dev/sda | gzip | ssh user@remote.PC.IP.Address ‘dd of=drive_backup.gz’ :Substituting /dev/sda for another disk if necessary
- Watch the interrupts on your system in realtime: watch -n.1 ‘cat /proc/interrupts’
- Mount a CD-ROM .ISO image file onto a local directory (be sure to mkdir the directory first):
mount -o loop CDROM.ISO /mnt/directory
- Download an entire website, including internal links, images and all:
wget -r -p -l0 -e robots=off -U mozilla http://www.website.com :Depends on many factors , sometimes fail
- Shutdown a Windows machine over the network (assumes you have an admin account):
net rpc shutdown -I Windows.PC.IP.Address -U username%password ;You can substitute ‘shutdown’ with ‘shutdown -r’ to reboot it instead.
- The Matrix in your console:
tr -c “[:digit:]” ” ” < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR=”1;32″ grep –color “[^ ]”
- And for the finale, just because you can: watch an ASCII version of Star Wars (yes, the movie!) via telnet:
telnet towel.blinkenlights.nl -:Activate telnet first then try
- Monitor changing files in real time
This command is fairly useful to watch your file system as it changes. It is more useful in just watching where changing files and percentages of drive space are critical. The command uses watch, df, and ls like so:
watch -d -n 2 ‘df; ls -FIAt;’ :The above command will refresh every 2 seconds and show you what is being changed on your file system.
- Record your Linux desktop from the command line
If you do not wish to install a dedicated application for recording your desktop, you can do it with this one-liner:
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /home/user/out.mpg :All you need is have ffmpeg already installed (and most systems do). Navigate to /home/user [If not create any directory and pint the path]]and you’ll find you MPEG video file there.This command writes video only, if you want to add audio recording.
use oss-i / dev/dsp0 or oss-i / dev/dsp1 :depending on your audio configuration.
So any similar commands /tricks to play with Linux shell , Share with us to gain info.