Key Linux Commands - Lecture Notes | CS 406, Study notes of Computer Science

Material Type: Notes; Professor: Carver; Class: Basic Linux System Admin; Subject: Computer Science; University: Southern Illinois University Carbondale; Term: Unknown 1989;

Typology: Study notes

Pre 2010

Uploaded on 02/24/2010

koofers-user-a1u
koofers-user-a1u 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Key Linux Commands
Documentation:
--------------------------------------------------
man - Format and display the on-line manual pages
help - Display help info about Bash builtin commands
info - Read/display Info documents
manpath - Determine user’s search path for man pages
apropos - Search the whatis database for strings
whatis - Search the whatis database for complete words
Command/File Information:
--------------------------------------------------
which - Shows the full path of a (shell) command
whereis - Locate the binary, source, and manual page files for a command
locate, slocate - Find file paths containing string using slocate database
find - Search for files in a directory hierarchy
type - Show if command is alias, etc.
file - Determine type of file
File Operations:
--------------------------------------------------
cat - Concatenate files and print on the standard output
tac - Concatenate and print files in reverse
more, less - Output file page by page
tail - Output the last part of files
head - Output the first part of files
rm - Remove files (or directories)
mv - Move (rename) files
cp - Copy files and directories
dd - Convert and copy a file
grep, egrep, fgrep - Print lines matching a pattern
ln - Make a hard/soft link to a file
od - Dump files in octal and other formats
source - Read and execute commands in a file [Bash builtin]
File Properties:
--------------------------------------------------
chmod - Change file access permissions
chown - Change file owner (and group)
chgrp - Change group ownership
stat - Display file or filesystem status
touch - Change file timestamps (or create empty file)
wc - Print the number of newlines, words, and bytes in files
Directories:
--------------------------------------------------
ls - List directory contents
pwd - Print name of current working directory
cd - Change directory
mkdir - Make directories
rmdir - Remove empty directories
du - Estimate file space usage
pushd - cd and add directory to the directory stack [Bash builtin]
popd - Remove directory from directory stack and cd [Bash builtin]
dirs - Display the currently remembered directories [Bash builtin]
File Comparison:
--------------------------------------------------
diff - Compare 2 files line by line
cmp - Compare 2 files byte by byte
comm - Compare sorted files by line
diff3 - Compare 3 files line by line
sdiff - Merge 2 files side-by-side
patch - apply a diff file to an original
pf3
pf4
pf5

Partial preview of the text

Download Key Linux Commands - Lecture Notes | CS 406 and more Study notes Computer Science in PDF only on Docsity!

Documentation:

man - Format and display the on-line manual pages help - Display help info about Bash builtin commands info - Read/display Info documents manpath - Determine user’s search path for man pages apropos - Search the whatis database for strings whatis - Search the whatis database for complete words

Command/File Information:

which - Shows the full path of a (shell) command whereis - Locate the binary, source, and manual page files for a command locate, slocate - Find file paths containing string using slocate database find - Search for files in a directory hierarchy type - Show if command is alias, etc. file - Determine type of file

File Operations:

cat - Concatenate files and print on the standard output tac - Concatenate and print files in reverse more, less - Output file page by page tail - Output the last part of files head - Output the first part of files rm - Remove files (or directories) mv - Move (rename) files cp - Copy files and directories dd - Convert and copy a file grep, egrep, fgrep - Print lines matching a pattern ln - Make a hard/soft link to a file od - Dump files in octal and other formats source - Read and execute commands in a file [Bash builtin]

File Properties:

chmod - Change file access permissions chown - Change file owner (and group) chgrp - Change group ownership stat - Display file or filesystem status touch - Change file timestamps (or create empty file) wc - Print the number of newlines, words, and bytes in files

Directories:

ls - List directory contents pwd - Print name of current working directory cd - Change directory mkdir - Make directories rmdir - Remove empty directories du - Estimate file space usage pushd - cd and add directory to the directory stack [Bash builtin] popd - Remove directory from directory stack and cd [Bash builtin] dirs - Display the currently remembered directories [Bash builtin]

File Comparison:

diff - Compare 2 files line by line cmp - Compare 2 files byte by byte comm - Compare sorted files by line diff3 - Compare 3 files line by line sdiff - Merge 2 files side-by-side patch - apply a diff file to an original

Environment Variables, Aliases, and Functions:

printenv - Print (select or all) environment variable values export - Move shell variable to environment (so inherited by children) [Bash builtin] set - Print values of all shell/environment variables and functions unset - Remove/undefine a variable [Bash builtin] declare - Show (or set) shell variables/functions [Bash builtin] env - Run a program in a modified environment setenv, unsetenv - Set/remove environment variable value [C shell] alias - Show (or set) alias value for command unalias - Remove/unset alias

System Information:

hostname - Show or set the system’s host name uname - Print system (kernel, etc.) information uptime - Tell how long the system has been running free - Display amount of free and used memory in the system vmstat - Report virtual memory statistics dmesg - Print or control the kernel ring buffer (e.g., boot messages) id - Print UID and GID info for current user or specified username last, lastb - Display list of recent logins/failed logins finger - Display information about system users (often disable now) who - Show who is logged in (often disabled now)

Processes:

ps - Snapshot of the current processes pstree - Display a tree of processes top - Display current processes (realtime) kill - Terminate a process (send a signal) fuser, lsof - Identify processes using files or sockets id - Print UID and GID info for current process nice - Run a program with modified scheduling priority renice - Alter priority of running process(es) umask - Set process’ file creation permissions mask [Bash builtin] ulimit - Control process resources limits [Bash builtin]

Filesystems/devices:

df - Report filesystem disk space usage mount - Mount a filesystem umount - Unmount filesystem fdisk, cfdisk, sfdik- Manipulate disk partition table mkfs - Build a Linux file system fsck- Check and repair a Linux file system debugfs - Ext2/ext3 file system debugger mkswap - Set up a Linux swap area swapon, swapoff - Enable/disable devices and files for swapping mknod - Make block or character special files dd - Convert and copy a file

Archiving and Compression:

tar - Package/unpackage files (archive) gzip, gunzip - Compress or expand files zip, unzip - Package and compress (archive) files bzip2, bunzip2 - Compress or expand files bzcat - decompresses files to stdout compress, uncompress - Compress or expand files (old) cpio - Copy files to and from archives dump - ext2/3 filesystem backup

Printing and Formatting:

lpr - Print files lpq - Show printer queue status lprm - Cancel print jobs lpstat - Print cups status information enscript - Convert text files to PostScript for printing, etc. a2ps - Format files for printing on a PostScript printer mpage - print multiple pages per sheet on PostScript printer

Booting, Startup/Runlevel, Shutdown:

lilo - Install LILO boot loader grub - Run the GRUB (boot loader) shell init, telinit - Change system runlevel halt, reboot, poweroff - Stop the system shutdown - Bring the system down mkrescue - Make rescue floppy (to boot disk from floppy/cd)

Services:

service - Start/stop/restart/status a system service/daemon chkconfig - Update/query runlevel information for system services

Network:

ping, ping6 - Send ICMP ECHO_REQUEST to network hosts ifconfig - Configure a network interface ifup, ifdown - Start/stop a network interface route - Show/manipulate the IP routing table netstat - Print network connections, routing tables, etc. traceroute - Print the route packets take to network host ethtool - Display or change ethernet card settings host, dig, nslookup - DNS lookup utilities whois - Client for the whois directory service (DNS) arp - Manipulate the system ARP cache iptables - Administration tool for IPv4 packet filtering and NAT arping - Send ARP REQUEST to a neighbour host iwconfig - Configure a wireless network interface iwpriv - Configure driver-specific parameters of a wireless network interface

Terminal:

stty - Change and print terminal line settings reset, tset - Terminal initialization clear - Clear the terminal screen screen - Terminal manager/multiplexer (multiple shells on a console)

Job Control:

jobs - List jobs (running in background) fg - Move job to foreground bg - Move job to background

Kernel Modules and Configuration:

lsmod - Show the status of Linux kernel modules modprobe - Add and remove modules from the Linux kernel insmod - Insert a module into the Linux kernel rmmod - Remove a module from the Linux kernel modinfo - Show information about a Linux kernel module usbmodules - List kernel driver modules available for a USB device mkinitrd - Creates initial ramdisk images for preloading modules sysctl - Configure kernel parameters at runtime

Hardware:

hdparm - Get/set hard disk parameters lshw - List hardware lspci - List all PCI devices lsscsi - List all SCSI devices lsusb - List USB devices usbview - Display information on USB devices

Time:

date - Print or set the system date and time hwclock - Query and set the hardware clock (RTC) ntpdate - Set the system date and time via NTP time - Time a command/program and give resource usage

File Integrrity Checking:

md5sum - Compute and check MD5 message digest (checksum) sha1sum - Compute and check SHA1 message digest (checksum)

Compiling and Libraries:

gcc -- Gnu Compiler Collection (C/C++ and more compiler) ./configure - Standard command to use autoconf script to create makefile(s) make - Build program(s) from source (invoking compiler) ar - Create, modify, and extract from libraries (archives) ldconfig - Update link bindings info for shared libraries ldd - Print shared library dependencies for an executable size - List section sizes in object and library files nm - List symbols from object files objdump - Display information from object files

Debugging

strace - Trace system calls and signals ltrace - Trace library calls gdb - GNU Debugger

RPM Software Package Management:

rpm - basic RPM package command urpmi - Mandriva RPM package command (understands dependencies) urpmi.addmedia, urpme, urpmf, urpmq - various urpmi-related commands rpmdrake - Mandriva GUI front end for urpmi yum - RH/Fedora RPM package command (understands dependencies) yumex - RH/Fedora GUI front end for yum

Debian Software Package Management:

dpkg - basic Debian package command apt-get - Command line front end for APT (understands dependencies) aptitude - Advanced text and command line front end for APT synaptic - GUI front end for APT dselect - Menu-driven package manager

Misc:

watch - Execute a program periodically, showing output fullscreen true, false - Do nothing, successfully, unsuccessfully mail, nail - Send and receive mail (command line) bc - An arbitrary precision calculator language (infix) dc - An arbitrary precision calculator language (RPN)