Notes on Linux Geared towards Red Hat 8/Fedora Core 1 intro ----- Gnome GNU Network Object Model Environment for Linux - window manager is mwm, Metacity Window Manager - file manager is nautilus - taskbar is gnome-panel KDE 'K' Desktop Environment for Linux - window manager is kwin - file manager is kfm - taskbar is kicker TWM Tab Window Manager Helpful tips ------------ You can move or resize a window by right clicking on the hortizontal bar at the top or along the perimeter of the window. This is sometimes necessary if you change screen resolutions and the window's widgets move off-screen. apps ---- /sbin/apcaccess status Show status of ups /sbin/arp -a Show arp cache arj x test.arj extract files from arj file artsd run the KDE sound server aterm -tr -fg white Run aterm with transparency on and foreground is white aterm -bg black -fg white Run aterm with black background and white foreground baby-gui-game-archive Loads a list of chess games in pgn format bin2iso file.cue -c file.bin Create cue file for file.bin bin2iso file.cue Create iso file using bin and cue file cam -s 0 -r 1 Retrieve 1st pic from Kodak DC215 cdda2wav -D /dev/cdrom Rip audio cd cdda2wav -D /dev/cdrom -x -t 1+20 -B Rip audio cd with 20 tracks to separate files cdrecord dev=ATAPI -scanbus Check for IDE burners cdrecord-prodvd -checkdrive dev=ATAPI:0,1,0 shows what drive can do cdrecord dev=1,1,0 -checkdrive newer method cdrecord -v -dev=1,0,0 speed=1 -dao -pad -useinfo track-01.wav ... make audio cd from wav file(s) cdrecord -v gracetime=2 dev=ATAPI:/dev/hdd speed=40 -dao driveropts=burnfree cuefile=videocd.cue -eject use cue file to write svcd cdrecord -v gracetime=2 dev=ATAPI:0,1,0 speed=8 -dao driveropts=burnfree cuefile=DATCD.cue -eject use cue file to write audio cd clamscan -r --mbox /var/spool/mail Scan mailboxes for viruses composite -dissolve 50 pic1.jpg pic2.jpg combo.jpg dissolve pic1 into pic2 creating combo convert *.xwd img_%04d.png convert all xwd files to png convert *.jpeg my_movie.mpeg convert jpeg files to mpeg convert -size 640x480 xc:"#000000ff" bl.jpg create a jpg convert *.jpg -resize 640x480 -bordercolor white -border 640x480 -gravity center -crop 640x480+0+0 %02d.jpg convert all jpg files to 640x480 and preserve aspect ratio cut -b 7-40 text.txt > text-col.txt cut out a column of text from postition 7 to 40 darkstat shows network traffic dos2unix file convert file from dos format to unix format /sbin/dumpe2fs /dev/hdc1 -h show superblock information for partition hdc1 dvdauthor -o test -x dvd.xml create dvd file system in subdirectory test using dvd.xml as a template dvdbackup -M -i/dev/dvd -o/temp create a duplicate of a dvd dvd+rw-mediainfo /dev/cdrom1 display media info edict word give dictionary entry for word eog Eye of Gnome, image viewer ethereal Packet Sniffer festival --tts file.txt convert text file to speech text2wave test.txt -o test.wav convert text to wav echo hello world | festival --tts use standard input with festival echo "My Message" | wall echo message to all users, kde will show via kwrited echo TEST | tee test echo TEST to stdout and also to file test ffmpeg -i testo.flv -ab 56 -ar 22050 -b 500 -s 320x240 testo.mpg convert flash video to mpeg ffmpeg -i test.flv -target ntsc-vcd test.mpg convert flash video to vcd compliment mpg ffmpeg -i test.flv -ac 2 -target ntsc-vcd test.mpg convert flahs video to vcd with stereo flac audio.wav Lossless audio compression, creates audio.flac freewrl test.wrl run VRML files g++ lesson02.cpp -lSDL -lpthread compile a SDL program gcc -dumpversion show version of gcc gcc --version show version of gcc gcc test.c -o test -g compile with debugging information gcc -time hello.c -o hello report amount of time taken by each process during compilation gdb program run gnu debugger with program gimp file.psd use gimp to read psd files glade-2 glade interface designer glxinfo display information about a glx extension and OpenGL renderer gnome-calculator gnome scientific calculator (also called gcalctool) gnome-character-map shows all 255 characters gnome-dictionary gnome dictionary gnome-system-monitor shows processes and system load gnome-pdf-viewer gnome pdf viewer gnome-terminal Gnome terminal emulation gataxx Gnome ataxx gocr -d -1 -v 1 scan.jpeg > output.txt convert scan.jpeg to text format gphoto2 --port "serial:/dev/ttyS0" --camera "Kodak DC210" --shell access gphoto2 shell to get or delete pictures gphoto2 --port "serial:/dev/ttyS0" --camera "Kodak DC210" -P --speed 38400 download all pictures gphoto2 --auto-detect -P auto-detect camera and download all pictures gqview gnu image viewer gqview -f -s display slideshow of files in current directory gqview --version display version information growisofs --help display help for growisofs gtk-gnutella run file sharing gvim vim with gtk frontend hwbrowser browse hardware identify -format '%w %h\n' *.jpg report the width and height of jpg files in pixels ilbmtoppm test.lbm > test.ppm import test.png -delay 10 wait 10 seconds then get current window img2iso file.img file.iso convert img file to iso (isodump renamed) /usr/bin/internet-druid configure internet setup /usr/sbin/irattach /dev/ttyS1 -d actisys -s run irattach on COM2 isoinfo -i homedvd.img -l check iso file homedvd.img java -jar JNetCube.jar run a jar file javac Hello.java compile java program, creates class file java Hello execute java program java -version display java runtime version akregator KDE news aggregator amarok KDE audio player ark KDE archiving tool k3b KDE CD/DVD burning facility k3b --version display version info kaddressbook KDE address book kaffeine KDE media player kalarm KDE personal alarm message, email scheduler kalzium KDE periodic table kate KDE advanced text editor kaudiocreator KDE cd ripper kcalc KDE calculator (convert hex to decimal) kcharselect KDE character selector kcontrol KDE control centre kdcop KDE graphic DCOP client/browser kdesu KDE su (run program with elevated privileges) kdevelop KDE integrated development environment kdict KDE dictionary kedit KDE text editor kfloppy KDE floppy utility kfontview KDE font viewer kghostview KDE ghostview kgpg KDE key management khangman KDE hangman game khelpcenter KDE documentation khexedit KDE hex editor khotkeys KDE hotkeys utility kit KDE instant messenger klinkstatus KDE web link checker klipper KDE clipboard utility kmahjongg KDE mahjong game kmines KDE mine sweeper kmix KDE mini mixer kmidi KDE midi player kmldonkey KDE frontend for mldonkey kmplayer KDE frontend for mplayer knode KDE news reader knotes KDE version of sticky notes kolourpaint KDE paint program konsole KDE terminal emulation kooka KDE scanner program kopete KDE (another) instant messenger korganzier KDE personal organizer kpackage KDE package installer kpaint KDE (another) paint program kpat KDE patience card games kpm KDE process manager kpdf KDE pdf viewer and printer kppp KDE internet dialer kpoker KDE poker game kpresenter KDE presentation tool krandrtray KDE resize and rotate screen utility krename KDE batch file renamer kreversi KDE othello kruler KDE screen ruler krusader KDE twin panel file editor kscd KDE cd player ksim KDE system monitor ksokoban KDE sokoban kstars KDE desktop planetarium ksnapshot KDE screen capture program kspread KDE spreadsheet program ksysguard KDE system guard kthesaurus KDE thesaurus ktimer KDE countdown timer, only accurate to 1 second ktip KDE useful tips kuickshow KDE image viewer kuser KDE user editor kwin4 KDE connect four kview KDE image viewer #2 kword KDE word processor (handles rtf files) quanta KDE web development environment kdialog --display :0 --msgbox "hallo" send a message to all users with kde kmixctrl --restore restore default volumes (needed for tv card) dcop kmix kmix-mainwindow#1 resize 1 1 sets kmix window to smallest size possible dcop kmix Mixer0 mixerName display name of the first mixer dcop kmix Mixer0 setVolume 0 0 set volume on first mixer device 0 to 0% dcop kmix Mixer0 toggleMute 6 toggle mute on device 6 (input line) dcop kmix Mixer0 setRecordSource 6 1 set device 6 as the record source dcop kdesktop KBackgroundIface currentWallpaper 1 return the name of the current wallpaper kooka -d hp:/dev/usb/scanner0 run kooka for specific device lame sample.wav sample.mp3 convert wav to mp3 lame file-in.mp3 -b 128 file-out.mp3 convert mp3 to 128 kbit latex2html sample.tex -image_type gif -split 0 convert latex file to html with one page and gifs locale get locale specific information locate xyz | grep -e xyz$ locate files ending in xyz locate -r httpd$ locate files ending in httpd lxdvdrip -st=copy backup a dvd lxdvdrip -st=mplayer -lang=en backup a dvd alternate method lxdvdrip -h -lang=en show help lxdvdrip -st=trans_par -lang=en -t=1 parallel transcoding title 1 lxdvdrip -st=vamps -f=2 -bp=1 -t=1 -lang=en title by title (cancel burning t=1,2,3 etc) lynx url run lynx on command line mozilla url run mozilla on command line To remove lock file for mozilla: cd /home/cubeman/.mozilla/default/xxxxx.slt (substitute xxxxx for the directory name) rm lock make -f makefile.unix compile using makefile.unix as a makefile makemap -r hash genericstable.db < genericstable Update genericstable makemap hash /etc/mail/virtusertable.db < virtusertable Update virtusertable mail user Send mail to local user mc visual shell for unix type systems can be used for undeleting files on ext2 partitions and viewing contents of rpm files shows numeric and character permissions of files mkisofs -dvd-video -o /mnt/r1/DVD/homedvd.img /mnt/r1/DVD/ make image for DVD mkisofs -dvd-video -udf -o dvd.iso dvd/ include udf support mogrify -colors 2 pic.jpg reduce pic.jpg to 2 colours mogrify -transparent "#3d8ff3" pic.png make colour #3d8ff3 transparent in pic.png mogrify -modulate 120,120 *.jpeg increase brightness and saturation 20% mogrify -sharpen 10 pic.jpg sharpen pic.jpg montage -tile 1x3 -geometry 800x1000 file1.jpg file2.jpg file3.jpg fileall.jpg combine 3 pictures into 1 picture and tile vertically mencoder -endpos 1:00 VTS_01_1.VOB -o file.vob -oac copy -ovc copy copy first minute of stream to file.vob mencoder file.mpg -o file.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4 convert mpg to avi mencoder file.mpg -o file.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4 -sub subtitle.srt convert mpg to avi and add subtitles mencoder file.mpg -o file.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4 -sub subtitle.srt -ffourcc DX50 convert mpg to avi and use different encoding mencoder dvd://1 -o test.mpg -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=3600 cuts size of dvd to 50% mencoder "mf://*.png" -mf fps=10 -ovc lavc -o file.avi convert a bunch of png files into an avi video mencoder -oac copy -ovc lavc -lavcopts vcodec=mpeg4 -o output.mpg input.avi -of mpeg experimental file conversion mencoder "mf://*.JPG" -mf fps=3 -o test.avi -ovc lavc convert JPG files to avi video at 3 frames per second mencoder input.wmv -oac -ovc lavc -lavcopts vcodec=mpeg2video -of mpeg -o output.mpg convert wmv to mpeg mencoder -vf rotate=2 -o output.avi -oac copy -ovc lavc input.avi rotate input.avi anti-clockwise and create output.avi mencoder -vf rotate=2 -o tempest-new.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg1video tempest.avi rotate and keep mpeg1 encoding mencoder -noskip -vf eq2=1.0:-.8 -o out-file.mpg -oac copy -ovc lavc -lavcopts vcodec=mpeg2video in-file.mpg -of mpeg -mc 0 create inverted video from mpeg2 to mpeg2 midentify file.mpg find information on a video file /usr/sbin/mouseconfig redhat mouse configuration utility necessary to get mouse working in tty mp3splt -s big.mp3 split big.mp3 on silence mp3splt -c big.cddb big.mp3 split big.mp3 based on big.cddb mpgdemux -b output video.mpg remultiplex video mplex -f 8 -M -V -o newvideo.mpg output* mpgtx -d -b test.mpg /mnt/cdrom/celtic.mpg mplex -f 8 -M -V -o output.mpg test.mpg-0.m2v test.mpg-0.mp2 remultiplex celtic.mpg mpgsplit -2 file.mpg split file.mpg into 2 parts mplayer *.avi -loop 25 Loop a video 25 times mplayer checker.avi -vo x11 -loop 0 Use x11 window, loop continuously mplayer * -shuffle play files in random order mplayer *[Ff]leet* play files with fleet, not case sensitive mplayer -ss 37:00 file play file 37 minutes in mplayer -aid 2 file play audio id 2 (for multi-language files) mplayer -sid 0 file.mpg play subtitles on id 0 mplayer -brightness 20 file.mpg play file with more brightness mplayer -zoom file.mpg play file in window which can be resized mplayer file.mp3 -ao artsd play audio through arts sound server mplayer file.mp3 -ao esd play audio through esd sound server (Enlightned Sound Daemon) mplayer -vo dga file.mpg play file using direct graphics access (must be root) mplayer -vo help list the available video output drivers mplayer -ao help list the available audio output drivers mplayer mms://media.exn.ca/exnmedia/exn20030903-cubeing.asf -dumpstream play a media file from exn.ca and save file mplayer -playlist play.pls -ao arts reference urls in text file play.pls mplayer -nocache -playlist mms://wm.cbc.ca/cbcr1-toronto listen to CBC Radio 1 (change r1 to r2 etc) mplayer -nocache -playlist http://microcrud.com/livestreams/crud.asx -dumpstream record stream via asx file mplayer -nocache -playlist http://mfile.akamai.com/8588/live/reflector:57833.asx?bkup=59561 how I listened to us open tennis radio mplayer -nocache -playlist http://mfile.akamai.com/8583/live/reflector:41143.asx?bkup=44574 how I listened to australian open tennis radio mplayer -playlist radio.asx to listen to australian open, wget radio.asx first mplayer -playlist file -dumpstream -dumpfile file.asf record stream and save as file.asf mplayer dvd://1 play dvd title 1 mplayer dvd://2 play dvd title 2 mplayer -dvd-device /dev/cdrom dvd://1 specify path to dvd device mplayer -ao pcm -aofile radio.wav radio.asf convert asf stream to wav mplayer -ao pcm -aofile week2.wav week2.rm -srate 44100 convert rm to audio cd ready wav file mplayer test.wmv -ao pcm:file=test.wav process audio from wmv to wav file mplayer -demuxer lavf flash9.flv play flash 9 file mplayer -tv driver=v4l:device=/dev/video0:width=640:height=480:norm=ntsc:chanlist=us-cable tv:// watch tv using mplayer mplayer radio://88.7 listen to radio mplayer tempest.avi -vf rotate=1 watch and rotate tempest video by 90 degrees clockwise mplayer tempest.avi -vf rotate=2 rotate video 90 degrees anti-clockwise mplayer -vo aa -monitorpixelaspect 0.5. video.mpg watch video in ascii mode mplayer -vf hue -hue -100 test.mpg watch video in negative colour mplayer -vo xv -vf eq2=1.0:-.8 04.mpg watch video in inverted colour (white<->black) mutt -f mailbox load another mailbox with mutt mutt -v show version and compile info mysqldump --opt drupal > drupal.sql backup drupal mysql drupal < drupal.sql restore drupal mysql --version display version of mysql /usr/sbin/netconfig Redhat network configuration utility newspost -i nntp file -n newsgroup -s subject -a -y post a file to usenet with pars using yenc encoding nmap 192.168.0.* scan ports on 192.168.0.1 through 192.168.0.255 nmap -sV 192.168.0.1 check software versions nroff -man manpage.1 using nroff to display a man page /usr/sbin/ntpdate -s ntp2.cmc.ec.gc.ca sets correct date and time (must be root) /usr/sbin/ntpdate -u chime.utoronto.ca update time oggenc audio.wav -o file.ogg Encode audio.wav to ogg format oocalc OpenOffice Calc for spreadsheets (*.xls) oodraw OpenOffice Draw for powerpoint (*.pps) e.g. oodraw rubik.pps oodraw rubik.ppt ooffice OpenOffice suite ooimpress OpenOffice create presentations oosetup OpenOffice setup oowriter OpenOffice word processor (*.doc, *.rtf) par c file.par Check parity archive par c *.PAR &> x.txt Redirect standard error to x.txt par r *.par Restore missing files par2 r *.PAR2 Restore missing files using PAR2 par2 c -r10 alpha * Create par2 files called alpha for all files in current directory pkg-config libdv --modversion display version of libdv pkg-config glib --modversion display version of glib pkg-config libpng --modversion display version of libpng ps2pdf invoice.ps invoice.pdf convert postscript invoice to pdf rar a -m5 jones.rar jones.mpg Create jones.rar with maximum compression rar a -m0 -v4700000 abc.rar abc.dat Create dvd sized chunks for file abc.dat no compress rar a -v700000 jones.rar jones.mpg Create jones.rar in 700 meg chunks rar e file.rar Extract files rar e -kb file.rar Keep broken extracted files rar e file.rar file1 /files Extract file1 to /files rar e file.cbr rar can extract cbr files rar e file.rar /mnt/floppy extract to floppy drive rar x file.rar extract files with full path readcd -v dev=1,0,0 f=cd.iso make an iso of a cd readcd -v dev=1,1,0 f=dvd.iso make an iso of a dvd realplay Realplayer plays rm files rec file.wav record a wav file rec -s w -c 2 -r 44100 record a wav file in 16-bit stereo with 44100 samples per second rexxc guess.rex guess compile guess.rex as guess rexx guess.rex execute rexx script guess.rex rsync -vu *.txt holdit update all *.txt files to subdirectory holdit rsync --version show version of rsync sar -n DEV Report network statistics rxpck/s total packets received per second txpck/s total packets transmitted per second rxby/s total bytes received per second txby/s total bytes transmitted per second rxcmp/s compressed packets received txcmp/s compressed packets transmitted scanimage -d hp:/dev/usb/scanner0 --mode color --resolution 100 -x 50 -y 50 > test.pnm Example of using a scanner from the command line, in this case the scan was 198x198 pixels scanimage --list-devices List available scanners scanimage --test Perform a scanner test scid Chess database program scp -r cubeman@24.112.147.60:/home/cubeman/polymake/png/* . transfer files securely /usr/bin/sensors show information from motherboard sensors (part of the lm-sensors package) /bin/setserial -bg /dev/ttyS0 displays information on 1st serial port sg_scan -i does a scan of sg devices sha1sum file compute and check SHA1 sort -k2 units.txt > units1.txt sort on 2nd column sox -h shows supported formats sox file.au file.wav Convert au to wav sox file1.wav file2.wav fade t 0 315 3 Make wav file fade out in last 3 seconds sox file1.wav file2.wav speed 2.0 make wav file at double speed sox file1.wav file2.wav trim 1:43:30 6:33 Trim file1 starting time 1:43:30 for 6 min and 33 s sox file1.wav -v 5 file2.wav make file2.wav really loud sox file1.wav file2.wav reverse file2.wav is the reverse of file1.wav sox -w -r 32000 -t ossdsp /dev/dsp3 -t ossdsp /dev/dsp pipe output from /dev/dsp3 to /dev/dsp spumux spumux.xml < input.mpg > output.mpg add subtitles to an mpg file ssh cubeman@24.112.147.60 open secure shell switchdesk [ desktop name] switch to a different desktop, e.g. kde, gnome, fvwm talk user talk to a user tar -xpvf file.tar extract files from tar archive tar -z -xpvf file.tar.gz extract files from gz tar archive tar -j -xpvf file.tar.bz2 extract files from bz2 tar archvie tar -cvf file.tar . make a tar archive file.tar including all files tar -tf file.tar list files in file.tar tar -vtf file.tar list files verbosely showing permissions and sizes tar -zcvf file.tar.gz . make a compressed tar archive including all subdirectories tar -jcvf test.tar.bz test make a compressed tar archive using bzip2 compression from file test tclsh hello.tcl execute a tcl script tclkit clock.kit execute a kit file telnet freechess.org 5000 logging into fics using text mode telnet localhost 113 test identd telnet localhost imap test imapd telnet localhost 873 test rsync telnet localhost 25 test sendmail timidity file.mid play midi file timidity file.mid -Ow convert midi file to RIFF wav file timidity file.mid -Ow -o out.wav convert midi to wav and output as out.wav tovid -svcd -full file.avi file.mpg convert file.avi to svcd format tovid -dvd -full file.avi file.mpg convert file.avi to dvd format and use 4:3 aspect ratio tovid -half-dvd -full -fps 24000:1001 file1.mpg file2 convert file1.mpg to 352x480 (half dvd) force 24 fps tovid -dvd -in antipode.avi -out antipode convert avi to mpeg using tovid 0.30 tovid -dvd -in /mnt/cdrom/celtic.mpg -out test -quality 10 make a dvd with highest quality using tovid 0.30 tovid -svcd -in file.wmv -out file -quality 10 make a svcd with highest quality using tovid 0.30 tput cols display the number of columns tput home home the cursor tput smcup save the screen tput rmcup restore the screen tput smso set reverse on tput rmso set reverse off unshar bsplit.shar unpack a shar file unzip test.cbz unzip works on cbz files unzip -l file.zip list files updatedb update the slocate database usbview usb viewer (reads /proc/bus/usb/devices) userdel -r user Remove a user usermount user mount tool uudeview file Decoder for binary files vcdgear -cue2mpg -track02 ga_v2s01.cue gav2_02 Extract track 02 and creat file gav2_02.mpg (don't try to extract track 0) vcdimager --iso-volume-label="test" track1.mpg track2.mpg ... create bin and cue files for vcd2 (default) vcdimager --iso-volume-label="test" --type=svcd file1.mpg file2.mpg ... create bin and cue files for svcd vcdimager --type=svcd --update-scan-offsets file1.mpg file2.mpg ... cdrdao --version display version of cdrdao cdrdao write --device 0,0,0 --driver generic-mmc --speed 8 videocd.cue write vcd w shows who is logged on and what they are doing also shows uptime watch -n 3 w watch output of w updated every 3 seconds wget --version shows version of wget wget custom.lab.unb.br/pub/lbl/sphere.c Grab a file off the web wget http://movies.apple.com/movies/paramount/team_america/team_america_m480.mov grab a trailer off the web wget 192.168.0.1/index.html grab a file from gateway wget ftp://linux.org/file.iso --limit-rate=40k grab a file but limit bandwidth use to 40k per second wget http://something.com/file.txt -O /home/test/file.txt grab a file and save it in /home/test wget -c http://something.com/file.txt resume a download partially completed who -r check current run level wine wincube.exe run windows program wincube.exe wine --version show version of wine wish Simple windowing shell wish clock.tk execute clock.tk (widget toolkit) xbasic Basic interpreter xbc Basic compiler (needs libtermcap.a) xcalc scientific calculator for X xclipboard Show clipboard xclock Analog clock xdosemu -home run dosemu in a window and use $HOME directory XFree86 -version display version number X server, currently using 4.3.0 http://www.xfree86.org/4.3.0/mouse.html xine -u 0 file.mpg play subtitles on 0 for file.mpg xls2csv newprice1024.xls > newprice1024.csv convert xls files to csv xmessage send a windowed message xmodmap -pke > old_layout.txt save old keyboard layout xmodmap usapl.txt load apl union keyboard xmodmap -e "pointer = 1 2 3 6 7 4 5" map mouse buttons xmtr Trace route (X My Trace Route) xpdf -z 200% book.pdf view book.pdf with 200% zoom yum install package install package yum remove package remove package yum update package update package yum update XFree86-tools update package XFree86-tools yum clean clean up yum cache yum install pdksh install the korn shell /usr/sbin/zdump -v /etc/localtime | grep 2007 check to see if DST is working zip -r aug14_2003_mail.zip * archive everything in current directory zip -T file.zip test integrity of file.zip commands -------- adduser user add a user apachectl start start apache web server apt-get update resynch the package update files apt-get install x install package x e.g. apt-get install rpm-build apt-get install kernel-source at -f moray-radio.sh 14:00 run moray-radio.sh script at 2 pm atq list user's pending jobs /sbin/badblocks /dev/hdc1 check for bad blocks /sbin/badblocks -s /dev/hdc1 check for bad blocks and show progress /sbin/badblocks -s -c 128 /dev/hdc1 check blocks, show progress, test 128 blocks at a time bc -l run bc with standard math library bzip2 -9 -z cube.txt compress cube.txt using maximum compression bunzip2 file.bz2 uncompress bz2 file cal show calendar cat /proc/cpuinfo show info on cpu cat /proc/ioports show ioports cat /proc/meminfo show memory usage cat /proc/pci show pci devices cat /proc/swaps show swap partitions and files cat /proc/bus/usb/devices show usb devices cat /proc/scsi/scsi show scsi devices cat /proc/sys/net/ipv4/neigh/eth0/gc_stale_time show arp cache time cat /etc/passwd show all users cat -n .bash_history show bash history cat *.mpg > all.mpg concatenate all mpg files into one file cat test.txt > /dev/lp0 send text directly to parallel port chage -l user show password expiry information chattr +i file set immutable bit for file chfn change finger information /sbin/chkconfig --list checks runlevel information for services chmod 755 / / should have 755 permisson chmod 700 /root /root should have 700 permission chmod 775 /var/spool/mail /var/spool/mail should have 775 permission chmod 666 file change permissions of file to read/write chmod 700 file read, write, execute by owner only chmod 766 file read, write, but only owner can delete chmod 600 file only owner can read or write chmod --reference file1.txt file2.txt sets permissions of file2 the same as file1 chown user file change owner of file to user Also increase security, don't let users reboot, shutdown, etc e.g. chmod 700 shutdown chmod 700 reboot chmod 700 halt chmod 700 poweroff While we're at it lock down internet programs chmod 700 wget chmod 700 elinks chmod 700 curl chmod 700 lynx chmod 700 vsftpd chmod 700 ftp chmod 700 lwp-download And let's lock down daemons chmod 700 acpid chmod 700 klogd chown -R user dir change all files to owner user in dir including all subdirectories chgrp -R user dir change all files to group user in dir including all subdirectories cmp -l file1 file2 compare file1 to file2 and print out differences csplit file /OFF/ {*} split a file on OFF as many times as possible date +%W show the week date +%D show date as mm/dd/yy date +%r show time as a 12 hour clock with AM/PM date +%c show date and time with 12 hour clock dd if=soundfx.wav of=test1.wav bs=1 skip=10564 count=155586 df -h show drive space df -lh show drive space on local volumes only df -hT show drive space and file system type diff -N file1 file2 > file.patch make a diff file dig +trace cooldomain.com ns @nameserver.com | more check if a nameserver is listed with the root servers dmesg > file capture boot messages to file /usr/sbin/dmidecode > dmidecode.txt DMI table decoder (Desktop Management Interface) du -hs data reports on size of data du -h -c *.zip reports on size of all zip files and give total du -ch *.pdf reports total size of all pdf files /sbin/e2fsck /dev/hda1 check a Linux second extended file system /sbin/e2fsck /dev/sda1 check usb hard drive eject eject cdrom eject -t close cdrom expr 45 + 5 evaluate expression factor 100 factor number into primes /sbin/fdisk /dev/sdb run fdisk on usb 2.0 drive /sbin/fdisk -l /dev/pda run fdisk on usb 1.0 drive to show partitions fdformat /dev/fd0H1440 low level format a 1.44 floppy /sbin/mkbootdisk 2.4.20-20.8smp make a linux boot disk with a label /sbin/mkbootdisk --device /dev/floppy /sbin/mkfs -t ext2 -c /dev/fd0H1440 make a ext2 file system on a floppy find / -perm +111 -name file -print find file with any executable permission set find . -inum -exec rm {} \; find file by inode number and remove find . -type d -maxpdepth 1 list directories find . -type f -perm +1 list executables find . -type f -perm +1 | xargs ls -d list executables and format output find ~ -size 5000k | xargs ls -l list files larger than 5 megs find / -user apache -print find files owned by apache find / -perm -002 -type d find world writeable directories find . -iname readme.txt find file using case insensitive match find / -user username | xargs rm -rf delete all files owned by username find . -size 0 -type f -print0 -exec rm -i {} \; delete all files size zero free -s 1 Show free memory results every second ftp host.org open ftp connection to host.org sftp host.org open secure ftp connection to host.org (shows progress of file transfers) fuser -vn tcp 80 show if there's anything on port 80 fuser -k /hd1 kill any process accessing /hd1 gethostip cubeman.org Get host ip for cubeman.org gpm General Purpose Mouse server grep [.] mame.txt | wc count literal "." grep " 1"[.] mame.txt | wc count literal "1." grep -n '[,].*[,]' file show lines with more than one comma grep -E [Cc]olou?r show lines with Colour, colour, Color or color grep -i blah * search for blah ignoring case egrep -i 'one.*two' * search for lines containing 'one' and 'two' groups displays the groups a user is in pgrep sendmail check if sendmail is running gzip -9 file.tar gzip a tar file with maximum compression, creates file.tar.gz gzip -9 *.mpeg gzip a group of mpeg files gzip -d file.gz decompress file.gz hdparm -Tt /dev/hdc test hard drive speed hdparm /dev/hda show concise information hdparm -I /dev/hda show detailed information including serial number hdparm -c1 -d1 /dev/hdc turn on dma and enable 32 bit support, put in /etc/rc.d/rc.local host blah.org lookup ip address for blah.org hostname display hostname hostname maxhost.org change hostname /sbin/ifconfig shows all ip addresses /sbin/ifconfig eth0 mtu 1452 sets value of mtu ispell file check spelling of file ispell -a check spelling of standard input (gives suggestions) e.g. at the prompt $ ispell -a $ type words here last shows last logins and logouts last -a list hostname in last column ldconfig configure dynamic linker run-time bindings note: do this after compiling and installing new libs located in /sbin ldd programs display a list of the shared libaries each program requires init n set runlevel n 0 - Halt 1 - Single-user mode 2 - Not used (user-definable) 3 - Full multi-user mode 4 - Not used (user-definable) 5 - Full multi-user mode (with an X-based login screen) 6 - Reboot jobs list current jobs kill -l display a list of signals kill -s 4 18564 send signal (illegal instruction) to process 18564 this should force a core dump killall mplayer kill all processes named mplayer killall -9 mplayer kill mplayer with SIGKILL killall -9 gconfd-2 kill gconfd-2 (had to do this to get gnome apps to work) killall bonobo-activation-server Had to kill the bonobo-activation-server to get realplay to work kudzu detects new or changed hardware ln -s /home/cubeman/j2sdk_nb/j2sdk1.4.2/jre/plugin/i386/ns610-gcc32/libjavaplugin_oji.so libjavaplugin_oji.so create a symbolic link to libjavaplugin_oji.so in /home/cubeman/.mozilla/plugins so that java will work in mozilla 1.5 ln -s /usr/java/j2re1.4.2_05/plugin/i386/ns610-gcc32/libjavaplugin_oji.so needed so that java will work for firefox 1.5 ln -s /var/www/maxhost/alex public_html make a link to web files in user's home directory ln -sf scd0 /dev/dvd make a link from scd0 to /dev/dvd ln -sf scd1 /dev/dvd make a link for 2nd dvd player /usr/sbin/lpc status Displays the status of one or more printer or class queues lp file print out file lp -d canon file print out file to destination canon lprm -a all flush all print jobs lpq show all print jobs lp -o cpi=17 file print file using 17 characters per inch ipcs -a display info on process communication /usr/local/lib/ipsec verify Check install for freeswan (must be root) /sbin/iptables -nvL Check rules for iptables /sbin/iptables -A INPUT -s 211.157.98.25 -j DROP block 211.157.98.25 cp `locate file` . copy file to local directory cp /mnt/c/rrr ~/rrr -r copy directory and all subdirectories cp -v *Concerto*09* /mnt/usb1 when copying files to a usb device like an mpeg3 player it's useful to see that each file successfully copies **Probably best to umount usb device before disconnecting cable** cp test.txt{,.bak} copy test.txt to test.txt.bak isodump shows contents of an iso file lastlog examine lastlog file ls -author list files by author ls -i list files by inode ls -lh list files in long format but with human readable form (time is only displayed for files younger than one year) ls -l --full-time show all time and date information ls -Slh list files sorted by size ls -lt list files in long format sorted by time ls -rt list files sorted by time in reverse order ls -lR / | grep -i .jpg list files with jpg, JPG, Jpg, etc extension ls -Slh | awk '{print $5}' parse 5th field ls | awk '{print $NF}' parse last field ls | grep -i juno list files with juno, not case sensitive ls *[Jj]uno* list files with Juno or juno ls *[1-2][0-9][0-9]* list files containing numbers 100 to 299 ls *[[:digit:]]* list files containing a number ls -Ifile.png list all files not matching file.png ls | wc -l list all files and show count ls -ld /proc/*/fd/* 2>&1 | fgrep '(deleted)' list all deleted files held open by processes ls --color=never list files without using colours ls -d h* list directory entries instead of contents, and do not dereference symbolic links ls | head -n5 list only the first 5 lines /sbin/lsusb list all usb devices /sbin/lsmod list kernel modules currently loaded /sbin/lspci show motherboard and card info /sbin/lspci -vv show all info (works best as root) /sbin/lspci -vv | grep HCI look for all types of Host Controller Interfaces /usr/sbin/lsof -i list internet open files /usr/sbin/lsof | grep /mnt show open files on /mnt /usr/sbin/lsof | grep /dev/dsp show open files on /dev/dsp /usr/sbin/lsof | grep /dev/ttyS show if serial ports are in use (lircd uses this device) man ascii information about ASCII man intro an introduction to Linux commands man -a usleep Get all pages for usleep, not just first match man -k vi Find all man pages which refer to vi /sbin/mkdosfs -s 8 -F 32 /dev/sdb1 creates a FAT32 partition with a cluster size of 4KB regardless of the partition size mkdir /hd1/pics/{dir1,dir2,dir3} create /hd1/pics/dir1 /hd1/pics/dir2 /hd1/pics/dir3 mknod /dev/usb/scanner0 c 180 48 make character device for usb scanner mount -l list all mounted volumes and their type mount -t iso9660 -o loop -vv test.iso /mnt/g/ mount iso file test.iso at /mnt/g/ mount /dev/sda1 /mnt/usb1 mount usb hard drive mount /dev/sda1 /mnt/usb1 -o umask=0000 mount usb hard drive so users can read and write files mount /dev/sdb1 /mnt/usb2 mount 2nd usb device mount /mnt/floppy mount disk in 1st floppy drive /dev/fd0 netstat -pan show all network activity newaliases rebuild /etc/aliases.db (needed after editing /etc/aliases ) nohup fics run fics so that it's immune to hangups od -x file show file in hexadecimal od -v -An -txC file.bin > file.txt dump binary file to text representation of hexadecimal passwd user set up password for user passwd -l user lock account for user paste one.txt two.txt output columns from both files combined together patch file file.patch patch a file php -v display php version php -m display modules perl -MCPAN -e shell start up CPAN perl Makefile.PL execute a perl makefile ping -c 5 test.org wait for 5 reply pings from test.org pmap -d pid display information about memory mappings for pid (process id) pr lem-rotate.c | lp pipe output from pr to lp printf '%d\n' 0x1e print decimal value of 0x1e printtool configure printer ps -efw | grep defunct look for zombie processes ps -efw --cols 200 run ps with screen width 200 ps -u nobody show processes run by usr nobody pstree show a tree of processes python -V display version of python python test.py run a python program pydoc -g display documentation for python modules quota user display disk usage and limits for user redhat-config-date configure date and time redhat-config-keyboard configure keyboard for redhat/fedora redhat-config-kickstart configure kickstart files redhat-config-mouse configure mouse for redhat/fedora redhat-config-network configure network redhat-config-packages configure packages for redhat from cdrom redhat-config-packages --isodir=/mnt/g/ Same but iso's are at /mnt/g/ redhat-config-printer configure printer redhat-config-proc kernel tuning for redhat-fedora redhat-config-rootpassword configure root password redhat-config-security-level configure firewall redhat-config-services configure services redhat-config-users configure users redhat-config-xfree86 configure display settings redhat-logviewer view redhat logs rename .jpeg .jpg *.jpeg reset reset terminal settings rm -r directory remove directory and all contents rm file remove file (or link) rm -- -file remove a file with a dash in it rm -i *.txt remove files with confirmation /sbin/rmmod usb-storage remove module usb-storage /sbin/insmod usb-storage load module usb-storage (had to reload when I added the hub) /sbin/insmod -f usbide force load of module usbide (needed this to get BF-2001 to work) /sbin/insmod soundcore load module soundcore (had to reload when trying to update oss drivers) /sbin/insmod es1371 load module es1371 (had to reload to get ensoniq card to work) /sbin/modinfo bttv display info about a module /sbin/modprobe -c show current configuration /sbin/modprobe ehci-hcd necessary to get usb 2.0 card to work /sbin/modprobe i2c-proc necessary to read sensors (check sensors.txt) route show or change the ip routing table rpm -e tux-2.2.7-3 remove tux rpm -qa List which packages are installed rpm -qa | grep tux see if tux is installed rpm -qf /bin/ls show which package contains /bin/ls rpm -e --nodeps mysql remove mysql without checking dependancies rpm -U package upgrade package rpm -i --force coreutils force reinstall of coreutils rpm2cpio package.rpm | cpio -idv extract files from rpm without installing cd /var/lib/rpm Fix stale locks when rpm gets stuck rm -f /var/lib/rpm/__db* rpm -rebuilddb Rebuild rpm database /sbin/runlevel show previous and current runlevel sed '15,329 w ggg' hhh > /dev/null write line range 15-329 from file hhh to ggg seq 1 10 output sequence from 1 to 10 seq -s\ 1 1000 output sequence from 1 to 1000 delimited by space /sbin/service --status-all show status of all services /sbin/service apcupsd stop stop apcupsd (must stop apcupsd to run apctest) /sbin/service crond stop stop crond daemon /sbin/service cups restart restart cups (common unix printer system) /sbin/service httpd restart restart web server /sbin/service lircd restart restart LIRC daemon /sbin/service mysqld restart restart the mysql server /sbin/service network restart restart network /sbin/service smb status check status of smbd and nmbd /sbin/service sshd stop stop sshd /sbin/service syslog status show status of system logger (must be root) /sbin/service syslog restart restart syslogd and klogd /sbin/service xinetd restart restart the super server shopt -s cdspell turn on cdspell, will correct misspellings with cd command shopt -s extglob turn on extended pattern matching facilities /sbin/shutdown -r -t 0 now shutdown and reboot system immediately sleep 5 ; beep sleep 5 seconds then beep smbclient \\\\192.168.0.10\\CA open a link to my windows box e.g. cd "Program files\winboard" get cubebox cubebox smbpasswd -a cubeman add smb user cubeman xset b off turn off beeps strace command > strace.txt 2>&1 trace system calls and signals and save to strace.txt stty -F /dev/cua0 get settings for serial port 1 stty -a show terminal settings stty -F /dev/ttyS0 115200 set 1st serial port to 115200 su -m switch to super user but retain environment /sbin/swapon /mnt/g/SWAP enable files or devices for swapping tail -f /var/log/secure check secure in real time tail -c 10000 /var/mail/cubeman show last 10000 characters of mail /usr/sbin/tcpdump -i eth1 show traffic on eth1 /usr/sbin/tcpdump port 80 show traffic for port 80 /usr/sbin/tcpdump host 69.36.243.188 -X -s 128 watch traffic from fics showing packets in hex and ascii showing up to 128 bytes /usr/sbin/tcpdump --version show version time ./size222 times execution of a program { time ls; } 2> time.output direct output of time to file time.output top shows dynamic info about cpu and memory trap "echo 'exiting'; exit " 2 break out of script on ctrl-c type -a command return how command would be interpreted ulimit -c 100000000 turn on core dumps ulimit -v 50000 limit virtual memory to 50 megabytes ulimit -v unlimited set no virtual memory limit ulimit -a show all limits uname -a displays operating system info uniq names.txt > unique.txt Place unique lines only in unique.txt units converts units uptime shows time since last reboot vi /proc/2678/status check status of pid 2678 vi -r list recoverable files vsftpd very secure ftp daemon '/usr/sbin/vsftpd &' edit /etc/vsftpd.conf for settings whatis png search the whatis database for png whatis word search the whatis database for word X -version prints out version of X xev print contents of X events xinetd eXtended internet services daemon '/etc/init.d/xinetd restart' xfontsel select an X11 font xlsfonts list fonts available for X xset s blank set screensaver to blank xvidcap --cap_geometry 400x240 prepare to capture a window of size 400x240 xvidcap --cap_geometry 1024x768 --fps .5 capture screen every 2 seconds bash shell ---------- . file execute file in current shell rather than a subshell $? variable returns exit status of last command edit .bash_profile add 'export TMOUT= 600' for 10 minute autologout set -o noclobber set shell so files aren't overwritten, e.g. echo X > test.txt will not overwrite file test.txt set +o noclobber turn clobber back on ctrl-a move to beginning of line ctrl-e move to end of line ctrl-r searches history ctrl-x bs delete entire line alt-. display last argument for last command ctrl-z suspends current task bg jobspec puts task in the background fg jobspec puts task in the foreground alias show current aliases alias abc='echo abc' set up alias for abc unalias abc remove alias for abc bash --version display bash version cd - return to previous directory #time prefacing commands with # turns them into comments !79:p print out command 79 but don't execute bind '"\e[24~": history-search-backward' bind the history-search-backward command to function key f12 echo $- display state of bourne shell flags echo x{1,2,3} example of brace expansion, outputs x1 x2 x3 default PS1 is [\u@\h \W]\$ STR="hello"; echo $STR set a variable unset STR unset a variable zshell ------ ls test<8-23> list filenames test8 through test23 inclusive rm ./*(D.L0) delete all empty files keys ---- ctrl-esc look at processes ctrl-alt-esc kill the window you click on next ctrl-alt-f1 go to text screen 1 ctrl-alt-f7 go to graphics screen 7 ctrl-alt-backspace kill session ctrl-alt-delete logout ctrl-alt-plus change to next video mode ctrl-alt-minus change to previous video mode ctrl-alt-l lock session ctrl-atl-n open new konsole alt-f1 display kde menu alt-f2 display run dialog (type logout here to logout) alt-f3 display windows operation menu alt-f12 toggle mouse emulation with keys use keypad arrow keys to move mouse pointer use keypad enter key for left-click press del followed by ins for right-click (kde 3.4.2 this was changed to ctrl-shift-numlock) alt-backspace delete line ctrl-alt-D toggle minimize all ctrl-alt-V show klipper menu ctrl-alt-R manually invoke action on current clipboard shift-left cycle through konsole sessions shift-backspace delete entire line in konsole keys within mplayer ------------------- > next song SPACE toggle pause / and * adjust volume 1 and 2 adjust contrast. 3 and 4 adjust brightness. 5 and 6 adjust hue. 7 and 8 adjust saturation h and k change channel (k = increment, h = decrement) files ----- $HOME/.bashrc called by .bash_profile $HOME/.bash_history bash history file $HOME/.bash_profile start up file for bash $HOME/.gconfd/saved_state had to delete this file one time due to a gnome error $HOME/.mail_aliases mutt address book $HOME/.muttrc mutt configuration file $HOME/.vimrc start up options for vim $HOME/.wine directory for wine files $HOME/.kdetest/share/apps/kaffeine/playlists kaffeine playlists are stored here (or .kde) e.g. Techno.kaffeine which is an xml file $HOME/.kdetest/share/config/kmixctrlrc start up file for kmixctrl $KDEDIR/share/autostart kde directory for applications to autostart /boot/grub/grub.conf configuration file for grub /etc/aliases alias file for sendmail /etc/crontab tables for driving cron /etc/fstab static information about filesystems /etc/group groups are set up here /etc/hosts static table lookup for host names /etc/inittab describes processes that are started at bootup /etc/inputrc describes shell commands /etc/logrotate.conf configure logrotate /etc/lxdvdrip.conf configuration file for lxdvdrip /etc/modules.conf configuration file for loading kernel modules /etc/securetty lists ttys from which root can log in /etc/services network services file /etc/sudoers configuration file for sudoers /etc/sysctl.conf preload/configuration file /etc/apcupsd/apcupsd.conf configuration file for apc ups daemon /etc/cups/printers.conf printer configuration file for cups /etc/httpd/conf/httpd.conf configure apache /etc/init.d/hplip restart restart hplip (Hewlett-Packard Linux Imaging and Printing project) /etc/init.d/cups restart restart cups /etc/mail/genericstable reverse-map local users for out-bound mail /etc/mail/virtuserstable maps virtual addresses into real addresses /etc/mail/local-host-names all aliases or virtual domains should be here /etc/mplayer/mplayer.conf system wide configuration file for mplayer /etc/profile.d/java.sh java setup file /etc/rc.d firewall scripts here /etc/rc.d/rc.local startup script /etc/ssh/sshd_config configure sshd /etc/sysconfig/network set hostname here /etc/sysconfig/network-scripts/ifcfg-eth0 network setup /etc/vsftpd/vsftpd.conf configure vsftpd /etc/X11/XF86Config configure X Server (including mouse) /usr/local/include directory for include files /usr/local/lib directory for libraries /var/ftp/pub directory for ftp server /var/log/cups/access_log log file for cups /var/spool/mail received mail is stored here /var/spool/clientmqueue /var/www/cgi-bin cgi-bin scripts echo 1 > /proc/sys/net/ipv4/ip_forward turn on ip forwarding within browser -------------- http://localhost:901/ run swat to configure samba http://localhost:631/admin configure cups http://127.0.0.1:4080 configure mldonkey ctrl-backspace delete line in URL window about:plugins about:config konqueror specific ------------------ for konqueror, remember to add arguments for xboard _manually_ otherwise it won't work! e.g. xboard -ncp -lgf %s fish://user@domain.com browse files remotely within konqueror media:/ show mounted devices man:/mke2fs show man page for mke2fs file.iso in konqueror right-click on iso file activates k3b automatically