Author: Christophe Gevrey
Updated: [udate]
| Area | Command | Description and/or Example |
| daemons | kill -9 PIDnumber | Kills the process PIDnumber that we want to (it stops running) kill -HUP PIDnumbe does the same. Kill -STOP PIDnumber Stopis until a new command the NumberPID process. Kill -CONT PIDnumber Resumes the numberPID process that we stopped before. |
| daemons | killall processname | Kills processname. |
| daemons | ps aux | Lists the aplications that are now running with his PID(Process IDentifier). ps aux | more Pauses between screens. Very useful to get information to kill a running process. |
| daemons | top | Shows the processes sorted by CPU use on real time, also free RAM and used SWAP. |
| daemons | xkill | Kills on X-windows the process that we select by clicking it with the mouse. It's the same as kill but on graphical mode. Hotkey: Ctrl+Alt+ESC |
| files | alias ls='ls --color=tty' | When you type ls you'll see color output but only if the output goes to screen (not a file) you could insert this line in ~/.bash_profile to always do it. |
| files | dd if=/dev/fd0 of=diskimagename | Makes a disk image and saves it on diskimagename file. |
| files | dd if=diskimagename of=/dev/fd0 | Saves the diskimagename file to a floppy disk. |
| files | df | Shows free disk space. |
| files | du -c files | Shows the total size used by the files. |
| files | du -s directory | Shows the directory size. |
| files | echo $PATH | Shows the current path. |
| files | emacs filename | Edits the filename Ctrl+X Ctrl+S (save), Ctrl+X Ctrl+C (quit). |
| files | find /directory -name 'filename' | Searches from directory the specified filename. |
| files | for x in $(ls /directory) do echo $x done | A little bash script to loop on the files in a directory. |
| files | grep | Searches for a string on a file. cat file.txt | grep stringtolookfor |
| files | joe filename | Text editor. |
| files | less file | I'ts like a better more, allows to go up and down and doesn't load the all the entire file when you call it. |
| files | ln -s /mnt/cdrom/Mame/roms /usr/games/lib/xmame | Makes a soft link to the cdrom roms directory as if it was /usr/games/lib/xmame (xmame must not exist) |
| files | mke2fs /dev/hda2 | Formats the second partition from the first hard disk using the Linux format (ext2). |
| files | more filename | Shows filename on screen (it's lik: type | more on ms-dos) . |
| files | mount /dev/hda1 /mnt/c -t vfat | Mounts fat32 partition. |
| files | pico filename | A basic text editor. Needs It's size in bytes is very low. |
| files | rm -rf directory | Deletes the directory and all the files within. No confirmation requiered. |
| files | sed | Changes a string for another one on a file (used with pipes). |
| files | sed 's/stringA/StringB/' filename > newfilename | Changes the first occurrence of stringA on filename for stringB and saves it in newfilename. |
| files | sed 's/stringA/stringB/g' filename > newfilename | Changes all the occurrence of stringA on filename for stringB and saves it in newfilename. |
| files | tail -f filename | Shows only the last lines of filename (good to follow on real-time log files). |
| files | tar -zcvf filename.tar.gz directory | Compresses in tarball the directory and all subdirectories into filename.tar.gz |
| files | tar -zxvf filename.tar.gz | Decompress filename.tar.gz |
| files | wc filename | Line count, word cound and byte count for the file. |
| files | whereis filename | Finds filename and says where it is using the internal data base, that must be updated. updatedb updates it. |
| files | zip -r targetfilename directory | Compress directory and all its folders on ficherodestino.zip |
| files | zip -r zipfilenameyouwant.zip desiredirectoryname | Compresses using zip the desiredirectoryname and all the subdirectories. |
| image | convert -resize 640x480 original.jpg modified.jpg | Converts image to 640x480 |
| image | mplayer videoyouwant.avi -vo aa | Plays the video on ascii art. |
| network | /etc/network/interfaces | Edit this file to change IP on Debian |
| network | ifconfig | Shows your IP also is used to configure your network card. |
| network | ncftp | An improved ftp client for console |
| network | netstat -lnp --ip | If you type it being root, will display current running daemons. |
| network | scp root@192.168.0.201:/boot/vmlinux . | Copies the file vmlinux remote from the host 192.168.201 via ssh to current directory. |
| network | wget -c --passive-ftp ftp://filename | Downloads the file or continues the download using FTP passive mode. |
| network | wget -c http://filename | Downloads the requested filename or continues the download if the connection was lost. |
| network | wget -rl 4 http://domainname | Downloads the website and all files on it until level 4 |
| sound | mpg123 -q /directory/*.mp3 & | Plays in background from the shell the .mp3 music files allocated on the directory. |
| system | /sbin/hdparm -d 1 /dev/hda | Sets using_dma bit to 1 to enable Ultra-DMA access to disk. |
| system | /sbin/hdparm -tT /dev/hda | Performs a timing benchmark on device reads. |
| system | /sbin/hdparm /dev/hda | Shows hard disk configuration parameters. |
| system | bash | sh Extension. |
| system | bc | Is a text mode calculator. |
| system | chs | C shell. |
| system | dpkg -i package.deb | Installs package.deb (Debian). |
| system | if [ -x /path/to/dnetc ]; then echo "Starting Distributed.net Client..." /path/to/dnetc -quiet fi | The file /etc/rc.d/rc.local is like autoexec.bat from ms-dos and we cand add this lines on it. If it's not running, will start dnetc application. |
| system | ksh | Korn shell, combines sh and csh. |
| system | last | Show list of last logged in users (reads /var/log/wtmp). |
| system | ltrace elfexecutable | Traces an elf executable program (nice hacking tool) |
| system | nohup scriptname & | Runs scriptname in background and keeps running even if you close the window shell. |
| system | pdksh | ksh Extension. |
| system | rpm -e rpmname | Uninstalls rpm previous isntalled package (the rpmname must be obtained from rpm -qa and without .rpm). |
| system | rpm -qa |grep ftp | List current installed ftp servers. |
| system | rpm -qpl package.rpm | Shows what files are on the package. |
| system | rpm -Uvh package.rpm | Upgrades an installed package with the new one or installs it. |
| system | setterm -blank 0 | Turns off console blank screensaver (that is On by default), you can put it on /etc/rc.local |
| system | sh | Changes to bash shell (Unix standard). |
| system | shutdown -h now | Shutdowns the computer. The same as halt |
| system | shutdown -r now | Reboots the computer. The same as reboot. |
| system | strace -s 200 executable | Intercepts system calls which are received by a process -s 200 is for string size 200 (nice hacking tools) |
| sytem | rpm -qi rpmname | Querys about version, complete description and more info for the package. |
| time | at 7:00
cdplay | Sets the computer to play the cd at 7:00. |
| time | atq | Lists the automatic programmed jobs. |
| time | atrm 8 | Deletes automatic job number 8. |
| time | date | Shows system date and time. |
| time | date -s "04/25/05" +"%D" | Changes sytem date to April, 25th 2005 . |
| time | date -s "15:00:00" +"%T" | Changes system time to 15:00. |
| time | Edit this file to memorize a job: etc/crontab | Ex: 00 00 20 10 * echo 'The winter is here' >/dev/null (this last command is to not send a mail to root). On the next directories you could copy applications or scripts that will run every time period. /etc/cron.hourly/ /etc/cron.daily/ /etc/cron.wee |
| time | rdate -p ntp.nasa.gov | Shows the server date and time. |
| time | rdate -s ntp.nasa.gov | Synchronizes your time and date with the server. |
| time | time application | Runs the application and when it's finished shows the running time. |
| time | uptime | Shows the total time since the computer was turned on. |
| users | /usr/bin/gpasswd -a user group | Asign that user to that group. |
| users | chmod mode file | Changes the file permissions |
| users | chown user:group file | Changes the file user and group owner. |
| users | gpasswd -d user group | To remove users from a group. The same is to edit: /etc/group |
| users | groups username | Shows groups that username is on |
| users | id username | Shows user identification and groups where he is on. |
| users | su | You become root until type: exit. |
| users | su - | Becomes root and reads root user's environment. |
| users | usermod -G group1,group2 user | Asign groups to a user. |
| X | setxkbmap | Try if your AltGr keys doesn't work on X mode. |
| X | switchdesk desktoptype | Changes the default desktop to anther (gnome, kde, wmaker, etc...). |