Bash Shell Commands

Directory Size

To get the size of a directory or multiple directories use the following command
$du -csh /home/* or $du -csh * for directory sizes at current location.
s does a summary for each item
c produces a grand total for all of the listed items
h produes figures in human readable format

Chown

chown [-R] [user][.][group] files
Recursively changes ownership of directories and their contents.

NFS Shares

showmount -e 192.168.1.32
mount -t nfs 192.168.1.32:/usr/home /mnt/nfs

Mplayer

To play DVD's use 768x578 dimensions
$mplayer scale=1024:576 dvd://1 -dvd-device /dev/hdd
$mplayer -aspect 16:9 dvd://1 -dvd-device /dev/hdd
To set the language when playing a movie. eg -alang hu, en
$mplayer dvd://1 -alang en
To override the the movie file's aspect ratio add the option -aspect 16.9 or -aspect 4:3

GREP

Get grep to search all the files in the current directory for a string.$ grep text *
Display all of the lines that start with a hash. $ grep ^# file.txt
Display all of the lines that don't start with a hash. $ grep ^# -v file.txt

CDPARANOIA

To get wave files and put them into the current directory.
$ cdparanoia -B "1-"

Unix Services

View Unix services attached to TCP/IP ports
# lsof -i

Keep a background process running after disconnect


$ nohup xmms * &

Show linux kernel parameters

$ sysctl -a | less

WGET

$ wget -r -l3 --no-parent -A "*" http://host/dir/page.html
Useful for downloading multiple files from a web page without clicking on lots of links. -l means 3 levels down.

xvidtune -show

Vendor: Monitor Vendor, Model: VM9G
Num hsync: 1, Num vsync: 1
hsync range 0: 30.00 - 95.00
vsync range 0: 50.00 - 160.00
"1280x1024" 157.50 1280 1344 1504 1728 1024 1025 1028 1072 +hsync +vsync

Bash Shell

Clear the users history file. History is an internal command.
$ history -c
Help on an internal command. $ help history
Type is an internal bash command, it tells you what kind of commmand, a command is. Eg $ type which

Date and Time

date --set 2005-9-25
date --set 10:38:00
Install the ntpdate package for the system to automatically set time.

Duplex Printing

1. Use xpp to set printer preferences to print odd pages only, click save settings then ok.
2. Print entire document.
3. Put odd printed pages back in the tray, face up with the page numbers towards the rear of tray. Page one should be on top.
4. Use xpp to set printer preferences to pint even pages only, click save settings then ok.
5. Print entire document.

Zip

Basic zip command that zips some files into a zip archive.
$zip [name_of_archive] [files_to_archive]
$zip stuff *fp5 *FP5
A ".zip" extension is automatically applied to the name of archive.
To list the contents of a zip file $ unzip -l docs.zip

Visual Bell

Replace the bell sound with the flash of the terminal window by adding the following line to the .inputrc file in your home directory.
set bell-stye visible

SSH

$ssh -L x:localhost:y remotehost
x=port localhost y=port remotehost

Audacity

To encode a voice grade audio sample to mp3 set the sample rate at 16000Hz and the sample format to 32bit float.
Download and compile lame and get audacity to link the library libmp3lame.so. Set the preference for libmp3lame.so to 16kbps.
Set the iGain level to 1% and line-in to 99%. To set the recording channel press the spacebar on the line-in channel.

Lilo

This information is very incomplete.
The map file stores the location of the kernels on the disk
The initrd.img file is used to store device drivers needed by the kernel but aren't stored in the kernel.
Running the # lilo -v will display verbose.

DELETING FILES WITH A SPECIAL CHARACTER

ls -b Will show the code of the non printable characher.
ls -q Will put a ? where ever a non printable character occurs.

DELETING FILES WHILE KEEPING THE DIRECTORY STRUCTURE


find . -iname "*txt" -exec rm '{}' \; Delete all text files from the directory below.
find . -type f -exec '{}' \; Delete regular files in the current directory and below while keeping structure.

CONVERTING A MAN PAGE TO TEXT FOR PRINTING

This command will convert a man page to text and remove special/esacpe characters.
man ls | col -b > example.txt

Extracting Text

Extracting text from a hard disk after deletion grep -30 --binary-files=text "yourtext" /dev/sda

FIREFOX

Install mplayer plugin to mozilla apt-get install mozilla-mplayer

QEMU

Instruction taken from quick start guide
qemu-img create -f raw win2k.img
qemu -cdrom /dev/cdrom -hda win2k.img -win2k-hack -boot d
Windows 2000 reports insufficient disk space, so use the -win2k-hack option. Mtools can access a raw fat32 partition when the image is not being used by QEMU.
Section "InputDevice" Identifier "touchscreen" Driver "evtouch" Option "Device" "/dev/input/event1" Option "DeviceName" "touchscreen" Option "MinX" "98" Option "MinY" "43" Option "MaxX" "940" Option "MaxY" "925" Option "ReportingMode" "Raw" Option "Emulate3Buttons" Option "Emulate3Timeout" "50" Option "SendCoreEvents" "On" EndSection Servers Layout
InputDevice "touchscreen" "CorePointer"
Copy Precompiled Binary
evtouch_drv.so
Run QEMU
qemu -hda win2k.img -cdrom /dev/cdrom -boot c -usb -usbdevice tablet -smb $HOME/share