Download Free Designs Free Websites Templates
Home / General / Key Linux Commands !!!

Key Linux Commands !!!

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

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)

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]

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

basename – Strip directory and suffix
cat – Concatenate and write files
csplit – Split by context
cut – Print selected parts of lines
dirname – Strip non-directory suffix
envsubst – Convert shell vars to environment values
expand – Convert tabs to spaces
fmt – Reformat paragraph text
fold – Wrap long input lines
grep, egrep, fgrep – Print lines matching a pattern
head – Output the first part of files
join – Join lines on a common field
nl – Number lines and write files
paste – Merge lines of files
pr – Paginate or columnate files
sed – Stream editor
seq – Print a sequence/list of numbers
sort – Sort text files
split – Split into fixed-size pieces
tac – Reverse files
tail – Output the last part of files
tee – Redirect to multiple files
tr – Translate characters
tsort – Topological sort
unexpand – Convert spaces to tabs
uniq – Uniquify files
wc – Print the number of newlines, words, and bytes in files
xargs – Convert standard input to command argument(s)

Login, Shell/Command, Logout:
su – Run as a substitute user (e.g., root)
sudo – Execute a command as another user (e.g., root)
exit – Exit a shell
logout – Logout/exit a login shell (e.g., SSH shell)
chroot – Run command or interactive shell with special root directory

Remote Login and File Transfer:
ssh – Secure remote login/shell
sftp – Secure file transfer program
scp – Secure remote file copy
rsh – Remote login/shell (insecure!)
rlogin – Remote login (insecure!)
ftp – File transfer program (insecure!)
rcp – Remote file copy (insecure!)

passwd – Update a user’s password
chsh – Change your login shell
useradd – Create a new user or update default new user information
userdel – Delete a user account and related files
usermod – Modify a user account
groupadd – Create a new group
groupdel – Delete a group
groupmod – Modify a group
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)

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

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

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

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

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

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
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)

About Amit Raj

Check Also

Find a Lawyer for your need – LawMatters

LawMatters, First time in India, Lawmatters provides an online dispute resolution platform. With the help of any ...