Linux Linux Linux Linux: Quickref
Linux Linux Linux Linux: Quickref
version 1.6.0
mount -t msdos /dev/fd0H1440 /mnt/floppy mount -t iso9660 /dev/cdrom /mnt/cdrom mount -t vfat /dev/hda1 /mnt/win mount -t ext2 /dev/pda /mnt/ezdrive umount /mnt/cdrom usermount
QuickRef
rm -rf dir ls -l ls -F ls -laC
Linux
September 2001
Remove the entire directory dir, forcing the removal of included files and subdirectories recursively as well. List files in current directory in long format. List files in current directory and indicate the file types. List all files in current directory in long format and display in columns. Display the file filename. Display the file filename one page at a time. Advance pages by pressing the spacebar. Display the file filename one page at a time. Advance pages by pressing the spacebar, backup with the b key. Display the first 10 lines of the file filename. Display the first 25 lines of the file filename. Display the last 10 lines of the file filename. Display the last 25 lines of the file filename.
Mounting Filesystems
Mount an MS-DOS formatted floppy disk at /mnt/floppy. Mount a CD-ROM drive at /mnt/cdrom. Mount a VFAT hard drive partition hda1 at /mnt/win. Mount a Linux filesystem formatted EZ-Drive cartridge at /mnt/ezdrive. Unmount the CD-ROM. Executes graphical utility for mounting and unmounting filesystems.
less filename
head filename head -25 filename tail filename tail -25 filename
Meta Characters
* ? [a-z0-9] [abc123] Multiple-character wildcard. Single-character wildcard. Single-character character range (a through z or 0 through 0). Single-character choice (a, b, c, 1, 2 or 3).
Symbolic Links
symlink -r / symlink -rv / | fgrep "dangling" ln -l linkname find . -type l exec ls -l {} \; List all the symbolic links on the system. Find all symbolic links that are "dangling", excluding other mounted filesystems. Display the link-path for a link. Find all symbolic links and show what they point to.
Linux QuickRef 1
lpq
File Permissions
User d r w x r Group w x r Others w x
Query and display jobs in print queue. Remove jobs from print queue. Print a file. Printer control tool. Run the X Windows printer setup utility.
File Type
-=file d=directory l=link b/c=block/char device
man Pages
man -k word man subject | col -b | lpr man -t subject | col -b | lpr Display man pages containing word. Print the man page subject as plain text. Print the man page subject as Prostcript.
When the command ls l is used, a list of file names is displayed. The first column in this list details the file type and the permissions applied to the file. If a permission is denied for a set, User (Owner), Group and Others, it is represented by a . File permissions are altered by giving the chmod command and the appropriate octal code for each set. Ex.: chmod 764 filename will make the file filename r-w-x for the user, r-w for the group, and r for any others.
Manual pages are organized into topics: /usr/man/man1 Commands - Commands you run from within a shell. /usr/man/man2 System Calls - Documentation for kernel functions. Library Calls - Manual pages for libc functions. Special Files - Information about files in the /dev/ directory. File Formats - Details of formats for /etc/passwd and other files. Games. Macro Packages - Descriptions of the Linux file system, manual pages, and others. System Management - Manual pages for root operator utilities. Kernel Routines - Documentation on Linux kernel source routines or kernel module specifications.
chmod Commands
chmod 600 chmod 700 chmod 755 chmod 711 chmod 444 chmod +x filename Read and write permissions for user only. Read, write and execute permissions for user only. Full permission for user, read and execute for group and others. Full permission for user, execute for group and others. Read permissions only for everybody. Make the file filename executable for everybody; user, group and others. Revoke write permissions for group and others on the file filename. Set the permissions to readable only for user and group on the file filename. Set the permissions to readable only for all (everybody) and add write-able for user on the file filename.
And each man page is organized into sections: Name The name of the command and a brief description. Synopsis Description Files How to use the command and commandline options. An explanation of the program and its options. A list of files used by the command and their location. A list of related man pages. A description of unusual output. Known problems. The program's main author and other contributors.
Printing
/etc/rc.d/init.d/lpd start /etc/rc.d/init.d/lpd stop /etc/rc.d/init.d/lpd status Start the print daemon. Stop the print daemon. Display the status of the print daemon.
Linux QuickRef 2
User Administration
adduser username passwd username su or su Create a new user account named username. Assign a password to username. Switch user to root, or root and to include roots set environment (must know root password to use). Switch user to username (root only). Exit, logoff or logout of account.
Configuration Files
/etc/inittab /etc/fstab /etc/motd /etc/rc.d/rc.local /etc/profile /etc/cron.* Specifies the runlevel that the system should boot into. List of devices, mount points and mount options (read, write, etc.). Message Of The Day; displayed to all users at login. Shell script that is executed at the end of boot process. Global environment variables. Directories that automatically execute scripts stored within at timed intervals. Contains full hostname including domain. A list of known host names and IP addresses on the network. Defines IP addresses of DNS servers. Configuration file for the Samba server, allowing file/print sharing with MS Windows clients. Configuration file for the Apache web server. Configuration file for X Windows. X Window application defaults. Configuration file for some X Window applications. Defines the window manager loaded by X Windows. Defines the window manager loaded by X Windows (Red Hat).
su username exit
Stop all processes and reboot. /etc/httpd/conf/ httpd.conf /etc/X11/XF86Config /usr/X11R6/lib/X11/ app-defaults ~/.Xdefaults ~/.xinitrc ~/.Xclients
System Services
chkconfig --list Reports whether an xinetd system service has been started or stopped. Checks the status of a particular service. Turns nscd service off in runlevels 3, 4, and 5. Stop or start the individual service <daemon>. To start or stop a service which is managed by xinetd. 3 4 5 6 Multiuser mode (console) unused Multiuser mode (X Windows) Reboot
chkconfig --list <daemon> chkconfig --level 345 nscd off service <daemon> stop [or start] service xinetd restart Linux Runlevels 0 1 2 Halt Single-user mode Multiuser, without NFS
tar -xzvf archive.tar.gz tar -tvf archive.tar ./configure ; make ; make install
Linux QuickRef 3
Pipe the output of history though the grep command, searching for variable. Executes the last command entered in the history file. Executes the command numbered "#" in the history file. Executes the command with the most recent matching string string. Display the shell environment variables. Display the environment variables in use.
mkbootdisk --device /dev/fd0 2.4-12 fdformat /dev/fd0H1440 /sbin/mke2fs -c /dev/fd0 tar -cMf /dev/fd0
efunnv printenv
vi Editor
:q :q! :wq x dw or dd D u . Quit, saving changes. Absolute quit (no prompt). Write file, then quit. Delete character at cursor. Delete word or delete line. Delete from cursor to EOL. Undo. Repeat last edit command.
cat /var/log/messages | less cat /var/log/dmesg | less dmesg | less linux single
X Windows
startx XF86Setup Start X Windows. An X configuration utility with automatic probing of graphics cards. Another X configuration utility with automatic probing of graphics cards. A text-based X configuration menu. An X graphics tuning utility. Starts GNOME in .xinitrc or .Xclients. Starts KDE in .xinitrc or .Xclients. Starts fvwm95 in .xinitrc or .Xclients. Increase or decrease screen resolution. Display a list of active windows. Resize the selected window. Refresh the screen. Start an xterm session. Invoke the xkill cursor. Kill the X-server.
Xconfigurator
xf86config xvidtune gnome-session startkde fvwm95 Ctrl-Alt+ -orCtrl-Alt Alt-Esc Shift-Ctrl-F8 Shift-Ctrl-r
uname -a
Bash Shell
history history 20 Search through the history file. List the last 20 commands entered.
Linux QuickRef 4