Linux Files and Command Reference 0.8.0
Linux Files and Command Reference 0.8.0
2. File Structure
3. Configuration Files
4. File Formats
Commands
5. Filesystem Management
6. File Management and Viewing
7. Help, Job and Process Management
8. Network Management
9. System Management
10. User Management
11. Printing and Programming
12. Document Preparation
13. Miscellaneous
Appendix
14. Credits
http://www.comptechdoc.org/os/linux/commands/linux_crindex.html7/2/2003 5:16:48 AM
CTDP Linux Files and Command Reference - Introduction
Introduction
This document briefly describes the Linux filesystem structure, Linux configuration files and how they
are used, and Linux commands and programs used for various functions on the system. This document is
divided into two sections. The first section describes the Linux filestructure, lists system configuration
files, and describes the filestructure of some of these files. The second section lists all commands and
briefly describes them. The commands are categorized according to system functionality. For further
information, the reader is encouraged to refer to the "Linux User's Guide", the "How Linux Works"
manual, and the various man and info pages for the various commands.
http://www.comptechdoc.org/os/linux/commands/linux_crintro.html7/2/2003 5:18:34 AM
Linux File Structure
❍ HTTP
❍ samba
❍ george
● bin - Commands needed during bootup that might be needed by normal users
● sbin - Like bin but commands are not intended for normal users. Commands run by LINUX.
● proc - This filesystem is not on a disk. It is a virtual filesystem that exists in the kernels
imagination which is memory.
❍ 1 - A directory with info about process number 1. Each process has a directory below
proc.
● usr - Contains all commands, libraries, man pages, games and static files for normal operation.
❍ bin - Almost all user commands. some commands are in /bin or /usr/local/bin.
❍ sbin - System admin commands not needed on the root filesystem. e.g., most server
programs.
❍ include - Header files for the C programming language. Should be below /user/lib for
consistency.
❍ lib - Unchanging data files for programs and subsystems
❍ local - The place for locally installed software and other files.
❍ doc - Documentation
❍ tmp
❍ X11R6 - The X windows system files. There is a directory similar to usr below this
directory.
❍ X386 - Like X11R6 but for X11 release 5
● boot - Files used by the bootstrap loader, LILO. Kernel images are often kept here.
● lib - Shared libraries needed by the programs on the root filesystem
❍ modules - Loadable kernel modules, especially those needed to boot the system after
disasters.
● dev - Device files
● var - Contains files that change for mail, news, printers log files, man pages, temp files
❍ file
❍ lock - Lock files. Used by a program to indicate it is using a particular device or file
❍ log - Log files from programs such as login and syslog which logs all logins and logouts.
❍ run - Files that contain information about the system that is valid until the system is next
booted
❍ spool - Directories for mail, printer spools, news and other spooled work.
❍ tmp - Temporary files that are large or need to exist for longer than they should in /tmp.
minute, hour, day of month, Month, day of week, (user name), command
/etc/fstab
Columns are: device file to mount, directory to mount on, filesystem type, options, backup
frequency, and fsck pass number (To specify the order in which filesystems should be checked on
boot; 0 means no check.) The noauto option stops this mount from being done automatically on
boot. Below is a detailed list of what is on each column.
/etc/hosts
Sets up host address information for local use. The format is:
/etc/inetd.conf
Sets the services under the inetd daemon. The fields of this file are:
1. service name
2. socket type
3. protocol
4. wait or nowait
5. user
6. server program name
7. server program command line arguments
/etc/inittab
Sets the init configuration. An entry in the inittab file has the following format:
id:runlevels:action:process
/etc/lilo.conf
Tells LILO how to boot
The lilo.conf file below is for a system which has a Linux root partition on /dev/hda1 and a MS-
DOS partition on /dev/hda2. See the "How Linux Works" guide and the "Linux User's Guidel"
for more information.
boot = /dev/hda # Tell LILO to install the boot loader on the /dev/hda disk boot record
vga = normal # Set a normal video mode
delay = 60 # The time in tenths of seconds to press <SHIFT> to get the LILO prompt
# Equivalent would be "prompt" on one line, and "timeout=60" on
# another line.
default=msdos # Sets the default boot to DOS, Without this line, the default is the first stanza
install = /boot/boot.b # The file containing the boot sector to use
compact # Have LILO perform some optimization.
map = /boot/map #Specifies the map file LILO creates when installed
# Section for Linux root partition on /dev/hda2.
image = /vmlinuz # Location of kernel
label = linux # Name of the OS that is displayed in the LILO boot menu
root = /dev/hda1 # Location of root partition, if this isn't here the kernel image must have
# this set using the rdev command
read-only # Mount read only on startup, Can also be set by rdev
# Section for MSDOS partition on /dev/hda1.
other = /dev/hda2 # Location of partition
table = /dev/hda # Location of partition table for /dev/hda2
label = msdos # Name of OS (for boot menu)
if the command "vga= ask" is given, LILO will prompt the user for a video mode at boot time.
/etc/passwd
The file has one line per username, and is divided into seven colon-delimited fields:
1. Username.
2. Password, in an encrypted form.
3. Numeric user id.
4. Numeric group id.
5. Full name or other description of account. This is called gecos.
6. The user's home directory.
7. The user's login shell (program to run at login).
/usr/X11R6/lib/X11/XF86Config
The main XFree86 configuration file. Type "man XF86Config"
The file, VideoModes.doc describes in detail how to determine the ModeLine values for each
resolution mode. Two files, modeDB.txt and Monitors,may have ModeLine information for your
monitor. They are located in /usr/X11R6/lib/X11/doc.
● The sixth section is "Screen" describing the video/monitor card configuration for the particular
server.
The Driver line specifies the X server that you will be using. Valid Driver values are:
_ Accel: For the XF86 S3, XF86 Mach32, XF86 Mach8, XF86 8514,
● Subsection "Display" defines several properties of the XFree86 server corre-sponding to your
monitor/video card combination. The XF86Config file describes all of these options in detail.
Most of them are not necessary to get the system working.
The options that you should know about are:
❍ _ Depth. Defines the number of color planes; that is, the number of bits per pixel. Usually,
Depth is set to 16. For the VGA16 server, you would use a depth of 4, and for the
monochrome server a depth of 1. If you use an accelerated video card with enough
memory to support more bits per pixel, you can set Depth to 24, or 32.
❍ _ Modes. This is the list of mode names that have been defined using the ModeLine
directive(s) in the Monitor section. In the above section, we used ModeLines named
"1024x768", "800x600",and "640x48"0. Therefore, we use a Modes line of
The first mode listed on this line is the default when XFree86 starts. After XFree86 is
running, you can switch between the modes listed here using the keys Ctrl - Alt –Numeric
+ and Ctrl - Alt - Numeric - .
It might be best, when you initially configure XFree86, to use lower resolution video
modes like 640x480, which tend to work with most systems. Once you have the basic
configuration working, you can modify XF86Config to support higher resolutions.
❍ _ Virtual. Set the virtual desktop size. XFree86 can use additional memory on your video
card to extend the size of the desktop. When you move the mouse pointer to the edge of
the display, the desktop scrolls, bringing the additional space into view. Even if you run
the server at a lower video resolution like 800x600, you can set Virtual to the total
resolution that your video card can support. A 1-megabyte video card can support
1024x768 at a depth of 8 bits per pixel; a 2-megabyte card 1280x1024 at depth 8, or
1024x768 at depth 16. Of course, the entire area will not be visible at once, but it can still
be used. The Virtual feature is rather limited. If you want to use a true virtual desktop,
fvwm and similar window managers allow you to have large, virtual desktops by hiding
windows and using other techniques, instead of storing the entire desktop in video
memory. See the manual pages for fvwm for more details about this. Some Linux systems
use fvwm by default.
❍ _ ViewPort. If you are using the Virtual option that is described above, ViewPort sets the
coordinates of the upper-left-hand corner of the virtual desktop when XFree86 starts up.
Virtual 0 is often used. If this is unspecified, then the desktop is centered on the virtual
desktop display, which may be undesirable to you.
apropos Search the whatis database for files containing specific strings.
bdflush Kernel daemon that saves dirty buffers in memory to the disk.
cd Change the current directory. With no arguments "cd" changes to the users home directory.
chmod <specification> <filename> - Effect: Change the file permissions.
Effect: change the file permission to rwx for owner, re for
Ex: chmod 751 myfile
group
Ex: chmod go=+r myfile Effect: Add read permission for the owner and the group
character meanings u-user, g-group, o-other, + add permission, - remove, r-read, w-write,x-
chmod exe
Ex: chmod a +rwx myfile Effect: Allow all users to read, write or execute myfile
Ex: chmod go -r myfile Effect: Remove read permission from the group and others
chmod +s myfile - Setuid bit on the file which allows the program to run with user or group
privileges of the file.
chmod {a,u,g,o}{+,-}{r,w,x} (filenames) - The syntax of the chmod command.
chown chown <owner1> <filename> Effect: Change ownership of a file to owner1.
chgrp chgrp <group1> <filename> Effect: Change group.
cksum Perform a checksum and count bytes in a file.
cp cp <source> <destination> Copy a file from one location to another.
dd Convert and copy a file formatting according to the options. Disk or data duplication.
dir List directory contents.
dircolors Set colors up for ls.
file Determines file type. Also can tell type of library (a.out or ELF).
Ex: find $Home –name readme Print search for readme starting at home and output full
path.
How to find files quickly using the find command:
Ex: find ~ -name report3 –print
find
● "~" = Search starting at the home directory and proceed through all its
subdirectories
● "-name report3" = Search for a file named report3
● "-print" = Output the full path to that file
ed Editor
emacs Full screen editor.
gitview A hexadecimal or ASC file viewer.
head head linuxdoc.txt - Look at the first 10 lines of linuxdoc.txt.
jed Editor
joe Editor
less q-mandatory to exit, Used to view files.
more b-back q-quit h-help, Used to view files.
pico Simple text editor.
tail tail linuxdoc.txt - Look at the last 10 lines of linuxdoc.txt.
vi Editor with a command mode and text mode. Starts in command mode.
apropos keyword - Show all commands with the keyword in their description. The same as
apropos
the "man -k" command.
Bash shell help for the bash builtin command list. The help command gets help for a
help
particular command.
man Get help from the manual for a command.
man -k keyword - Show all commands with the keyword in their description
man
"man 2 kill" - Display page 2 of the kill command
manpath Determine user's searchpath for manpages.
Documentation on Linux commands and programs similar to the man pages but navigation
info
is organized different.
● u (more info)
● a (see all)
● -l (technical info)
ps
Meanings:
● PPID-parent process ID
● PID-process ID
arp This program lets the user read or modify their arp cache.
dig(1) Send domain name query packets to name servers for debugging or testing.
finger Display information about the system users.
ftp File transfer program.
ifconfig Configure a network interface.
ifdown Shutdown a network interface.
ifup Brings a network interface up. Ex: ifup eth0
ipchains IP firewall administration used to set input, forward, and output rules.
netconf A GUI interactive program to let you configure a network on Redhat systems.
netconfig Another GUI step by step network configuration program.
Displays information about the systems network connections, including port
netstat connections, routing tables, and more. The command "netstar -r" will display the
routing table.
nslookup Used to query DNS servers for information about hosts.
pftp Same as ftp.
ping Send ICMP ECHO_REQUEST packets to network hosts.
portmap DARPA port to RPC program number mapper. Must be running to make RPC calls.
rarp Manipulate the system's RARP table.
rcp Remote file copy. Copies files between two machines.
rexec Remote execution client for an exec server. The host uses the rexecd server.
Query RIP gateways. Request all routes known by an RIP gateway by sending an RIP
ripquery
request.
rlogin Starts a terminal session on a remote host.
route Show or manipulate the IP routing table.
rsh Executes command on remote host.
Displays summary of current system status of a remote host or all hosts on the
rup
network.
ruptime Show host status of local machines.
rwhod System status server, maintains database used by rwho and ruptime.
showmount Show mount information for an NFS server.
Access control facility for internet services. Can be set up to monitor requests for
tcpd Telnet, finger, ftp, exec, rsh, rlogin, tftp, talk, comsat. It filters access for these
requests.
tcpdchk Tcp wrapper configuration checker.
Dump traffic on a network. Prints out headers of packets that match the boolean
tcpdump
expression.
tcpdmatch Predicts how the tcp wrapper will handle a specific request for a service.
Telnet User interface to the TELNET protocol, setting up a remote console session.
traceroute Print the route that packets take to the specified network host.
ipx_configure Tool to setup Netware access.
ncpmount Netware filesystem mounting program.
nprint Novell print command.
pqlist Netware printer list for a given server.
pserver Netware print server.
slist Netware server list.
nn Net news.
Program for internet news and e-mail, Can send documents, graphics, local & remote
pine
messages.
sendmail A popular Unix, Linux mail message transfer agent.
smail A popular mail message transfer agent which is easier to set up than sendmail.
talk Lets two parties talk simultaneously.
telnet Allows a user to have a login session across a network on a remote host.
tin Net news reader.
write Allows users to directly interact with other users via terminal number (one way at a time).
Library management
ldconfig Updates the necessary links for the run time link bindings.
ldd Tells what libraries a given program needs to run.
ltrace A library call tracer.
trace Same as ltrace.
System Information
System Logging
klogd Kernel log daemon which intercepts and logs Linux kernel messages.
logger Make entries in the system log.
syslogd Linux system logging utilities.
System Security
System time
cal Calendar.
clock Used to change or get current time. The command "clock -–w" sets the hardware clock.
date Print or set the system date and time.
hwclock Set or read the hardware CMOS clock.
Time server daemon to synchronize the host's time with other machines, normally invoked
timed
at boot time from the rc(8) file.
timedc Timed control program.
tzset Used to change the users private time zone by setting the TZ environment variable.
uptime Reports how long the system has been running.
zdump Prints the current time in each zonename named on the command line.
zic Reads text from files named on the command line and creates time conversion files.
Linux Programming
as86 Assembler
awk C programming language - allows finding of lines with specific characters.
bc A precision calculator language.
cproto Reads in c source files and generates function prototypes for all the functions.
ctags Generate tag (index) files for source code.
dialog Display dialog boxes from shell scripts.
egcs GNU project C and C++ compiler.
f2c Converts fortran code to c code.
gawk Pattern scanning and processing language. GNU's implementation of awk.
GNU c and c++ compiler.
gcc -g Produce debugging information.
-pg Generate profile info that will allow the gprof program to display timing info.
gdb Debugging program.
gprof In /usr/bin, allows you to tell where most of the execution time is spent in a program.
igawk Gawk with include files.
Reformats c source code for consistent indenting and opening and closing brackets
indent
consistent.
ld The GNU linker.
ld86 Linker for as86.
make GNU make utility to maintain a group of programs.
nm Lists symbols from object files.
objcopy Copy and translate object files.
objdump Display information from object files.
p2c Converts pascal code to c code.
set prompt = "waldo" (in C shell) ps1 = 'waldo' (in BOURNE shell)
prompt PS1="[\u@\h \w]\\$ " makes prompt = [username@hostname current directory]
see the BASH or your shell's man page for more information.
size List section sizes and total size.
strip Discard symbols from object files.
xxgdb X windows based graphical user interface to gdb.
Scripting Languages
Perl A command interpreter for the Practical Extraction and Report Language (perl).
Python A report language.
Tcl Tool command language shell. Enter by typing tclsh.
info Return information about the state of the Tcl interpreter.
Tk A graphical user extension to Tcl based on X windows. Commands are same as Tcl.
Ncurses functions
CD programs
Other
Ex:: alias dir='ls -a' - Effect: Makes dir list all files (no spaces next
alias
to the = sign).
bison GNU project parser generator.
chvt Change foreground virtual terminal.
crack Program used to find bad passwords or crack security.
cvs Concurrent Versions System.
deallocvt Gets rid of unused virtual terminals.
dumpkeys Dump keyboard translation tables.
fc Fix command. Used to edit the commands in the current history list.
gdbm The GNU database manager.
gpm A cut and paste mouse server.
history Show commands listed in the shell history (last n).
lilo Boot management program.
mc Visual shell for Unix like system. A file manager.
nc A file manager.
pdksh Public domain Korn shell.
pilot Filesystem browser.
PS1="Please enter a command" Set Bash level 1 response.
PS2="I need more information" Set Bash level 2 response.
rcs Recision Control system. Change RCS file attributes.
sash Standalone shell with built in commands.
screen Screen manager with VT100 terminal emulation.
sleep Ex: "sleep 2" - wait 2 seconds.
tcsh C shell with filename completion and command line editing.
unalias Ex: "unalias dir" - Effect: Removes the alias dir.
units Unit conversion program.
● set - Ex: set t=/temp
Sound
Credits
Document:
CTDP Linux Files and Command Reference Version 0.8.0
Author:
Mark Allen
http://www.comptechdoc.org/os/linux/commands/linux_crcredits.html7/2/2003 5:43:17 AM