Vous êtes sur la page 1sur 2

The Top Banana Linux Cheat Sheet

[ General Edition ]
Helpful Links #1:
http://www.snc.edu/compsci/linux/basic.html | http://mindprod.com/linux.html | http://www.linuxnovice.org/documents/bootcamp.txt # mke2fs /dev/fd0 # mformat /dev/fd0 # eject # kdiskfree Drive space # df # du -s /mydir # fdisk -l # fsck /mnt/remote # e2fsck Format with ext2 Format with FAT Eject CD-ROM tray GUI mount utility Shows disk space usage Space used by directory Disk/partition information Check file system Check ext2 file system

Samba

(www.samba.org)
Redhat location

Shows output of running job (exit with Ctrl-C) # tail -f opfilename # jobs # kill -9 pid # kill -9 %job# List current jobs Kill by process ID Kill by job number

Samba configuration file:


/etc/samba/smb.conf To mount the 'public' directory of the Win98 machine 'gromit' on the local machines mount point /mnt/pub # smbmount //gromit/public /mnt/pub Add a new samba user: # smbpasswd -a <username> <password>

Start a process at a higher then normal priority # nice -1 <appname> # renice 1 <pid> Lower a processes priority

Configuration
# # # # sax sax2 mouseconfig kbdconfig Configure XFree86 v3 Configure XFree86 v4 Mouse setup Keyboard setup

Files
# ls -l # ls -la # ls -l /usr List files in currect directory List hidden files List files in directory /usr Create link dir1->dir2 Copy a file Delete myfile Move myfile Rename 'src' to 'dest' Find file, start at / Ignore case Compare two files Copy disk image Backup file system Restore a dump backup Flush disk buffers Change file timestamp

System
# dmesg # dmesg -c # uname -a # sysreport # uptime Shows all kernel messages Clears kernel messages Display basic system info Create System report Time since reboot

# ln -s dir1 dir2 # # # # cp rm mv mv <src> <dest> myfile myfile /abc <src> <dest>

Loadable Kernel Modules


# # # # # lsmod insmod mymod.o rmmod mymod depmod mymod.o modprobe mymod.o Lists all loaded modules Loads 'mymod.o' Unloads 'mymod.o' Creates dependancy list Use dep list to load module

# find / -name file # find / -iname file # diff file1 file2 # dd # dump # restore # sync # touch <file>

Viewing Files
# # # # # # cat myfile more myfile less myfile head myfile tail myfile wc -l myfile Displays file 1 screen at a time Displays using vi Displays file head Displays file tail Line count of file

View reboot log entries in the file /var/log/wtmp # last reboot # reboot Reboot system # halt Halt system # shutdown -h now Turn off system Change Run Level # telinit x x = 1 Single user x = 3 Multi user x = 5 Multi user (graphical login)

Printing
# # # # # lpr lpq lpc printtool cp file /dev/lp0 Add file to print queue Display print queue Line printer control Graphical printer setup Send file to printer

File Permissions
Change file permissions: # chmod 777 myfile Owner/Group/Others rwx rwx rwx

Compressed Files
To uncompress 'mylib.tar.gz' # gunzip -d mylib.tar.gz Which creates 'mylib.tar', and then # tar xpvf mylib.tar If tared & bzip2ed, unpack using: # bzcat file.tar.bz2 | tar xv Or use: # tar xjfv file.tar.bz2 If tared & gziped, unpack using: # tar xvzf file.tar.gz # tar xvzf file.tgz Also # tar xvf filename.tar # tar tvf filename.tar # tar cvf new.tar dirname Zip and rar files: # zip file.zip # unzip file.zip # rar file.rar # unrar file.rar

Change a files user & group ownership: # chown <username> <filename>

Text Search
# # # # # # # grep abc myfile grep -I abc myfile grep I am myfile grep $ myfile grep $USER: myfile grep -r abc *.txt fgrep Search for word abc Case insensitive search Search for phrase I am Search Search Recursive search Search

Directories
# mkdir dir1 # rmdir dir1 # pwd Change directory # cd /dir1/dir2 # cd ../dir1 # cd ~ Create directory dir1 Remove directory dir1 Present working directory using Absolute path using Relative path to Home directory

Text Editors
# # # # # # pico myfile.txt kate myfile.txt gedit myfile.txt kedit myfile.txt emacs vi Simple editor Programmers file editor Gnome text editor KDE text editor

Unpack archive View only Create archive

Delete directory & contents recursively # rm -rdf dir

Zip a file Unzip a file Create a rar archive Unpack a rar archive

RPM
# # # # rpm rpm rpm rpm -i -q -V -e file.rpm -a | less file.rpm package_name Install an RPM List of packages Package integrity Uninstall package

Help
# # # # # man [command] info [command] command --help whatis [command] apropos keyword Show man pages View info pages Commands own help Brief command info Search whatis DB for string

Processes
# ps -A # pstree # top Shows all processes Displays process trees Process resource usage

Drives
# hdparm Get/Set hard disk parameters Mount floppy drive Unmount floppy drive Low level format floppy

File Conversion
# file filename # ps2png file.ps file.png Finds file type Convert ps to png

Shows processes owned by specific user # ps aux | grep username

# mount /mnt/floppy # umount /mnt/floppy # fdformat /dev/fd0

Version 0.2.2 Official download site http://www.rebootsoft.com Copyright 2003 Dominic Curran This document is published under the GNU Free Documentation Licence. Visit the GNU web site (http://www.gnu.org) for more information. Linux is a registered trademark of Linus Torvalds. Tux logo is Copyright 1997 Andreas Dilger & Larry Ewing.

Page 2

Helpful Links #2:


www.linuxhq.com/guides/GS/gs.html | http://tldp.org | http://www.dsl.org/cookbook | http://www.linux.org | http://www.linuxhelp.net # ps2gif file.ps file.gif # nenscript Convert ps to gif Convert txt to ps # kthememgr Theme manager Process manager RPM package management File manager File locator X Terminal Screen capture utility Scientific calculator Simple Hex editor Communications tool

Console
# clear # ad<tab><tab> # exit [alt]+F1 - F7 Clear screen Auto complete command Close console Swtch to console 1-7

File Viewers
# gv file.ps # xdvi file.dvi # kuickshow Run GhostView Run DVI viewer

Network Utilities
# # # # # # # # # # # # ifconfig ifup -o debug eth0 route hostname -i cat /proc/net/arp dig nslookup netstat tcpdump traceroute ping ypwhich Shows network interface Run interface script Shows routing table Shows IP address View ARP cache DNS lookup utility Name server lookup Network connections Dump network packets Print packet route Ping utility Print name of NIS server

Serial Comms
/dev/ttyS0 /dev/ttyS1 # minicom # mseyon Equivalent of COM1 Equivalent of COM2 Console Comms app XWindows Comms app

# # # # # # # # #

kpm kpackage kfm kfind konsole ksnapshot kcalc khexedit kwmcon

Gnome Desktop
/usr/bin

(www.gnome.org)
Gnome apps directory

Dialers / Modem Management: # rp3 Redhat dialer # wvdial Console dialer # gnomeppp Gnome dialer # kppp KDE dialer # kpppload KDE PPP load monitor # xisp X Windows dialer

Install Gnome theme's from gtk.themes.org # # # # # # # gtksamba gnomba grpm gfde gpasswd ghex gnusniff Configure Samba Samba browser Redhat RPM manager File manager Password manager Hex editor Network packet sniffer

Cron System
# kcron # crontab -e # crontab -l KDE Task Scheduler Edit personal crontab file List content of crontab file

Hardware
Information on reported interrupts: # cat /proc/interrupts # cat /proc/stat # # # # # # # cat /proc/pci cat /proc/ioports cat /proc/cpuinfo cat /proc/devices lsusb lspci kudzu Info from PCI probe Info on IO ports Capabilities of CPU Device numbers List USB devices List PCI devices RH hardware manager

User Basics
# # # # set alias export chsh Change environment variables Create a command alias Change Change current shell Displays the date & time Lookup user info

Edit / list crontab file for another user: # crontab -u [username] -e # crontab -u [username] -l # at # atq # atrm Queue job for execution Examine job queue Remove job from queue

# date # finger

Login
# # # # # # # login logout passwd whoami su su john exit Sign in and switch user Sign out current user Change password Show current user logged in Change to root Change to user john Change back to previous user

User & Group Administration


# # # # useradd userdel usermod passwd Add a user Delete a user Modify user details Change root password Lock an account Unlock an account Displays a users groups Add a new group Delete a group KDE user manager Users login history Shows users logged in

X Windows

(www.xfree86.org)
X apps directory X11 config file (Redhat)

/usr/bin /etc/X11/XF86Config # # # # # # startx xf86config xconfigurator xf86setup xdpyinfo xlock

# passwd -l <username> # passwd -u <username> # # # # # # groups groupadd groupdel kuser last who

Memory Usage
# free # vmstat # cat /proc/meminfo Shows RAM usage Shows virtual memory Shows memory usage

Start X Windows Primitive X configuration Console mode X configuration X configuration (runs in X) Xserver information Locks X Windows Switches to virtual terminal 1

[ctrl]+[alt]+F1

LDAP
# # # # # ldapwhoami ldapadd ldapdelete gq directory_administrator Add a LDAP entry Delete a LDAP entry Management GUI Admin GUI

Services
Configuring services: # ntsysv Redhat's service manager List all services Add a service Status of all services Start a service Stop a service Restart a service

OpenSSH
Open a secure shell on a remote machine # ssh user@machine Open a secure shell as current user # ssh machine Run a batch of commands on a remote machine # ssh machine 'cd ~; pwd;' Copy 'myfile.txt' to a remote machine # scp myfile.txt machine: Perform copy as a different user # scp myfile.txt user@machine: # sftp Secure File Transfer

Or at the command line (RedHat): # chkconfig --list # chkconfig add <name> # # # # service service service service status-all <name> start <name> stop <name> restart

Power Management
# apmsleep # apm -v # xapm Put machine to sleep/standby state Query APM BIOS Control APM

File Management & Location


# mc # nautilus # konqueror # # # # whereis <cmd> where <cmd> updatedb locate <file> Midnight Commander Nautilus KDE file manager Locate binary, src & man files Display executables path Create file location database Display location of file

KDE Desktop
/opt/kde

(www.kde.org)
KDE directory

Install KDE theme's from www.themes.org

Version 0.2.2 Official download site http://www.rebootsoft.com Copyright 2003 Dominic Curran This document is published under the GNU Free Documentation Licence. Visit the GNU web site (http://www.gnu.org) for more information. Linux is a registered trademark of Linus Torvalds. Tux logo is Copyright 1997 Andreas Dilger & Larry Ewing.