Linux Quickref Linux Version 1.6.0 September 2001
Total Page:16
File Type:pdf, Size:1020Kb
Linux Linux QuickRef version 1.6.0 September 2001 rm -rf dir Remove the entire directory “dir”, Mounting Filesystems forcing the removal of included files and subdirectories recursively mount -t msdos Mount an MS-DOS formatted as well. /dev/fd0H1440 floppy disk at /mnt/floppy. /mnt/floppy ls -l List files in current directory in long format. mount -t iso9660 Mount a CD-ROM drive at /dev/cdrom /mnt/cdrom. ls -F List files in current directory and /mnt/cdrom indicate the file 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 cat filename Display the file “filename”. /mnt/ezdrive /mnt/ezdrive. more filename Display the file “filename” one umount /mnt/cdrom Unmount the CD-ROM. page at a time. Advance pages by pressing the spacebar. usermount Executes graphical utility for mounting and unmounting less filename Display the file “filename” one filesystems. page at a time. Advance pages by pressing the spacebar, backup with the “b” key. Finding Files and Text Within Files head filename Display the first 10 lines of the file find / -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”. tail filename Display the last 10 lines of the file grep –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”. locate 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. apropos 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”, which filename Show the subdirectory containing “c”, “1”, “2” or “3”). the executable file “filename”. info 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 mv filename Move the file “filename” to the mounted filesystems. /home/dirname directory /home/dirname. ln -l linkname Display the link-path for a link. cp filename Copy the file “filename” to the find . -type 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 w x r w x r w x lpc Printer control tool. printtool Run the X Windows printer setup File Type Execute utility. -=file Write =directory d 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 man page “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. “chmod” command and the appropriate octal Read = 4 code for each set. Ex.: Write = 2 chmod 764 filename Manual pages are organized into topics: /usr/man/man1 Execute = 1 will make the file “filename” r-w-x for the user, Commands - Commands you run from r-w for the group, and r for any others. within a shell. /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/passwd 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. chmod a=r,u+w Set the permissions to readable Synopsis How to use the command and command- 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. /etc/rc.d/init.d/lpd Author The program's main author and other 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/fstab List of devices, mount points and mount options (read, write, etc.). su 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 Shell script that is executed at the only). end of boot process. exit Exit, logoff or logout of account. /etc/profile Global environment variables. /etc/cron.* Directories that automatically Shutdown & Reboot execute scripts stored within at timed intervals. shutdown -h now -or- Shutdown the system now and 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 host 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. /etc/httpd/conf/ Configuration file for the Apache Installing Software for Linux httpd.conf web server. rpm -ivh name.rpm Install 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 window manager (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 <daemon> 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 <daemon> stop Stop or start the individual service tar -xvf archive.tar Decompress the files archived in [or start] <daemon>. 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 1 Single-user mode 5 Multiuser mode (X Windows) “archive.tar”. ./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 history | grep Pipe the output of history though Tips & Tricks variable the grep command, searching for “variable”.