<<

QuickRef Linux version 1.6.0 September 2001

-rf dir Remove the entire directory “dir”, Mounting Filesystems forcing the removal of included files and subdirectories recursively -t msdos Mount an MS-DOS formatted as well. /dev/fd0H1440 floppy disk /mnt/floppy. /mnt/floppy -l List files in current directory in long format. mount -t iso9660 Mount a -ROM drive at /dev/cdrom /mnt/cdrom. ls -F List files in current directory and /mnt/cdrom indicate the types. mount -t vfat Mount a VFAT hard drive partition ls -laC List all files in current directory in /dev/hda1 /mnt/win hda1 at /mnt/win. long format and display in columns. mount -t ext2 Mount a Linux filesystem /dev/pda formatted EZ-Drive cartridge at filename Display the file “filename”. /mnt/ezdrive /mnt/ezdrive. filename Display the file “filename” one umount /mnt/cdrom Unmount the CD-ROM. page at a . Advance pages by pressing the spacebar. usermount Executes graphical utility for mounting and unmounting filename Display the file “filename” one filesystems. page at a time. Advance pages by pressing the spacebar, backup Finding Files and Text Within Files with the “b” key. filename Display the first 10 lines of the file / -name filename Starting at the / directory, find the “filename”. file “filename”. head -25 filename Display the first 25 lines of the file find / -name Starting at the / directory, find the “filename”. “*string*” file containing the word “string”. filename Display the last 10 lines of the file –r textstring Starting with the directory “/dir”, “filename”. /dir recursively find and list all files containing the string “textstring”. tail -25 filename Display the last 25 lines of the file “filename”. filename Locate a file “filename” using the updatedb database (see next). Meta Characters updatedb Create or update the database used by the locate command. * Multiple-character wildcard. subject List man pages for “subject”. ? Single-character wildcard. makewhatis Create or update the database [a-z0-9] Single-character character range used by whatis and apropos (“a” through “z” or “0” through “0”). commands. [abc123] Single-character choice (“a”, “b”, filename Show the subdirectory containing “c”, “1”, “2” or “3”). the executable file “filename”. Lists the commands and utilities Symbolic Links installed with brief description as to what they are used for or do. symlink -r / List all the symbolic links on the system. symlink -rv / | fgrep Find all symbolic links that are Move Copy, Delete and View Files "dangling" "dangling", excluding other filename Move the file “filename” to the mounted filesystems. /home/dirname directory /home/dirname. -l linkname Display the - for a link. filename Copy the file “filename” to the find . - l - /home/dirname directory /home/dirname. Find all symbolic links and show exec ls -l {} \; what they point to. rm name Remove the file or directory “name”. LINUX IS A REGISTERED TRADEMARK OF LINUS TORVALDS. COPYRIGHT © 2000 DAVID D. SCRIBNER

Linux QuickRef 1 lpq Query and display jobs in print queue. File Permissions lprm Remove jobs from print queue. User Group Others lpr Print a file. d r x r w x r w x lpc Printer control tool.

printtool Run the X Windows printer setup File Type Execute utility. -=file d=directory l=link Read man Pages b/c=block/char device man -k word Display man pages containing “word”. 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 man subject | Print the “subject” as permissions applied to the file. If a permission is denied for a set, col -b | lpr plain text. User (Owner), Group and Others, it is represented by a –. man -t subject | Print the man page “subject” as File permissions are altered by giving the col -b | lpr Prostcript. “” command and the appropriate octal Read = 4 code for each set. .: Write = 2 chmod 764 filename Manual pages are organized into topics: Execute = 1 /usr/man/man1 Commands - Commands you run from will the file “filename” r-w-x for the user, r-w for the group, and r for any others. within a .

/usr/man/man2 System Calls - Documentation for kernel

functions. chmod Commands /usr/man/man3 Library Calls - Manual pages for libc chmod 600 Read and write permissions for functions. user only. /usr/man/man4 Special Files - Information about files in the chmod 700 Read, write and execute /dev/ directory. permissions for user only.

/usr/man/man5 File Formats - Details of formats for chmod 755 Full permission for user, read and /etc/ and other files. execute for group and others. /usr/man/man6 Games. chmod 711 Full permission for user, execute for group and others. /usr/man/man7 Macro Packages - Descriptions of the Linux file system, manual pages, and others. chmod 444 Read permissions only for everybody. /usr/man/man8 System Management - Manual pages for

root operator utilities. chmod +x filename Make the file “filename” executable for everybody; user, /usr/man/man9 Kernel Routines - Documentation on Linux group and others. kernel source routines or kernel module specifications. chmod go-w filename Revoke write permissions for group and others on the file

“filename”. And each man page is organized into sections: chmod ug=r filename Set the permissions to readable only for user and group on the file Name The name of the command and a brief “filename”. description. Synopsis How to use the command and command- chmod a=r,u+w Set the permissions to readable filename only for all (everybody) and add line options. write-able for user on the file Description An explanation of the program and its “filename”. options.

Files A list of files used by the command and their Printing location. /etc/rc.d/init.d/lpd Start the print daemon. See Also A list of related man pages. start Diagnostics A description of unusual output. /etc/rc.d/init.d/lpd Stop the print daemon. stop Bugs Known problems.

Author The program's main author and other /etc/rc.d/init.d/lpd Display the status of the print status daemon. contributors.

Linux QuickRef 2

User Administration Configuration Files adduser username Create a new user account named /etc/inittab Specifies the runlevel that the “username”. system should boot into. passwd username Assign a password to “username”. /etc/ List of devices, mount points and mount options (read, write, etc.). or su - Switch user to root, or root and to include root’s set environment /etc/motd Message Of The Day; displayed (must know root password to use). to all users at login. su username Switch user to “username” (root /etc/rc.d/rc.local that is executed at the only). end of boot process. Exit, logoff or logout of account. /etc/profile Global environment variables. /etc/.* Directories that automatically & Reboot execute scripts stored within at timed intervals. -or- Shutdown the system now and shutdown -h now init 0 halt (no reboot). /etc/HOSTNAME Contains full hostname including domain. shutdown -r now -or- Shutdown the system now and init 6 reboot. /etc/hosts A list of known names and IP addresses on the network. shutdown -r 5 Shutdown the system in 5 minutes and reboot. /etc/resolv.conf Defines IP addresses of DNS servers. halt Stop all processes and shutdown. /etc/samba/smb.conf Configuration file for the Samba reboot Stop all processes and reboot. server, allowing file/print sharing with MS Windows clients.

Installing Software for Linux /etc/httpd/conf/ Configuration file for the Apache httpd.conf web server. rpm -ivh name.rpm the RPM package “name.rpm”. /etc/X11/XF86Config Configuration file for X Windows. rpm -Uvh name.rpm Upgrade or install RPM package /usr/X11R6/lib/X11/ X Window application defaults. “name.rpm”. app-defaults rpm -Fvh name.rpm Upgrade only previously installed ~/.Xdefaults Configuration file for some X RPM package “name.rpm”. Window applications. rpm -e name Delete the RPM package “name” ~/.xinitrc Defines the (do not include “.rpm” extension). loaded by X Windows. rpm -l name List the files in the RPM package ~/.Xclients Defines the window manager “name”. loaded by X Windows (Red Hat). rpm -ql name Query for the installed version and list the files in the RPM package System Services “name”. chkconfig --list Reports whether an xinetd system rpm -Va Verify the integrity of all currently service has been started or installed packages. stopped. rpm -qai Query all installed packages, chkconfig --list Checks the status of a particular displaying details on each service. package. chkconfig --level 345 Turns “nscd” service off in rpm -i --force name Reinstall package “name”, forcing nscd off runlevels 3, 4, and 5. the installation of all files included. service stop Stop or start the individual service tar -xvf archive.tar Decompress the files archived in [or start] . the tarred file “archive.tar.gz”, listing the contents to the console. service xinetd To start or stop a service which is restart managed by xinetd. tar -xzvf Decompress the files archived in archive.tar.gz the gzipped and tarred file Linux Runlevels 3 Multiuser mode (console) “archive.tar.gz”. 0 Halt 4 unused tar -tvf archive.tar Display list of contents in file

“archive.tar”. 1 Single-user mode 5 Multiuser mode (X Windows) ./configure ; make ; Execute the scripts preparing the 2 Multiuser, without NFS 6 Reboot make install source files for compiling and installation on the system.

Linux QuickRef 3 | grep Pipe the output of history though Tips & Tricks variable the grep command, searching for “variable”. -a List IP address for all devices on system. !! Executes the last command entered in the history file. /sbin/e2fsck hda5 Execute the filesystem check utility on the hard drive partition !# Executes the command numbered hda5 (unmount hda5 first!). "#" in the history file. mkbootdisk --device Creates a boot disk on the floppy !string Executes the command with the /dev/fd0 –2.4-12 drive with version 2.4-12 of the recent matching string kernel. “string”. fdformat Format a floppy disk in device fd0 efunnv Display the shell environment /dev/fd0H1440 as high-density 1.44 MB. variables.

/sbin/mke2fs -c printenv Display the environment variables Format a floppy disk with the /dev/fd0 Linux ext2 filesystem, checking for in use. bad blocks. tar -cMf /dev/fd0 Backup the contents of the current Editor directory, including subdirectories, :q Quit, saving changes. to multiple floppy disks. :q! cat /var/log/messages Display the system log with Absolute quit (no prompt). | less paging. :wq Write file, then quit. cat /var/log/dmesg Display the boot messages log x Delete character at cursor. | less with paging; useful for troubleshooting. dw or Delete word or delete line. dmesg | less D Delete from cursor to EOL. Same as above. linux single Issued at LILO prompt, will boot u Undo. into single-user mode (if root . Repeat last edit command. password is lost, boot “linux single” and change password). List current running processes for X Windows logged user. startx Start X Windows. ps -aux List all current running processes XF86Setup An X configuration utility with for all users and daemons. automatic probing of graphics cards. 1234 Kill (stop) a process with job ID of “1234”. Xconfigurator Another X configuration utility with automatic probing of graphics sysreport Red Hat utility collects detailed cards. info on the system's hardware and setup, creating a compressed tar xf86config A text-based X configuration file in the /tmp directory by that menu. name and can be used by xvidtune An X graphics tuning utility. SysAdmins to back up most of the system's configuration. -session Starts GNOME in .xinitrc or .Xclients. ulimit -c Displays current limit on core file size. startkde Starts KDE in .xinitrc or .Xclients. ulimit -c 1000 Sets allowable size limit on core fvwm95 Starts fvwm95 in .xinitrc or files to 512K (1000 x 512-byte .Xclients. blocks). Ctrl-Alt+ -or- Increase or decrease screen -a Displays system info (OS, host Ctrl-Alt– resolution. name, kernel version, date, time, time zone, year, processor type Alt-Esc Display a list of active windows. and label). Shift-Ctrl-F8 Resize the selected window. Shift-Ctrl-r Refresh the screen. Bash Shell history Search through the history file. Shift-Ctrl-x Start an xterm session. history 20 List the last 20 commands Ctrl-Alt-Esc Invoke the xkill cursor.

entered. Ctrl-Alt-BkSpace Kill the X-server.

Linux QuickRef 4