Friday, November 20, 2020

Frequently Used Linux Commands

 

File Viewing

Command Function
cat Display the contents of file
less Page through files
head show the top portion of a file
more display screenfuls of a file
tail display bottom portion of a file
nl count the number of lines in a file
wc count the number of lines, words and characters in a file
od View a binary file
tee display output on stdout and write it to a file simultaneously

File Management

Command Function
ls display file attributes
stat display file attributes
wc count the number of lines, words and characters in a file
file identify file types
touch set the time stamp of a file or directory
chgrp change the group of a file
chmod change the permissions (mode) of a file
chown change the owner of a file
chattr change advanced file attributes
lsattr display advanced file attributes

File Manipulation

Command Function
awk pattern-matching, programming language
csplit split a file
cut display columns of a file
paste append columns in a file
dircmp compare two directories
find find files and directories
perl scripting language
sed Stream Editor
sort sort a file
tr translate chracters in a file
uniq find unique or repeated lines in a file
xargs process multiple arguements


File Editing

Command Function
vi text editor
emacs text editor
sed Stream Editor

Locate Files

Command Function
find find files and directories
which locate commands within your search path
whereis locate standard files

File Compression and Archiving

Command Function
gzip compress a file using GNU Zip
gunzip uncompress a file using GNU Zip
compress compress a file using UNIX compress
uncompress uncompress a file using UNIX compress
bzip2 compress a file using block-sorting file compressor
bunzip2 uncompress a file using block-sorting file compressor
zip compress a file using Windows/DOS zip
unzip uncompress a file using Windows/DOS zip
tar read/write (tape) archives
cpio copy files to and from archives
dump dump a disk to tape
restore restore a dump
mt tape control programm

File Comparison

Command Function
diff find differences in two files
cmp compare two files
comm compare sorted files
md5sum compute the MD5 checksum of a file
sum compute the checksum of a file

Disks and File Systems

Command Function
df display free space
du display disk usage
mount mount a filesystem
fsck check aand repair a filesystem
sync Flush disk caches


Printing

Command Function
lpr print files
lpq view the print queue
lprm Remove print jobs
lpc line printer control program


Process Management

Command Function
ps list processes
w list users’ processes
uptime view the system load, amount of time it has been running, etc.
top monitor processes
free display free memory
kill send signals to processes
killall kill processes by name
nice set a processes nice value
renice set the nice value of a running process.
at run a job at a specific time
crontab schedule repeated jobs
batch run a job as the system load premits
watch run a programm at specific intervals
sleep wiat for a specified interval of time

Host Information

Command Function
uname Print system information
hostname Print the system’s hostname
ifconfig Display or set network interface configuration
host lookup DNS information
nslookup lookup DNS information (deprecated)
whois Lookup domain registrants
ping Test reachability of a host
traceroute Display network path to a host
Character based web-browser

Networking Tools

Command Function
ssh Secure remote access
telnet Log into remote hosts
scp Securely copy files between hosts
ftp Copy files between hosts
wget Recursively download files from a remote host
lynx

File and Directory Basics

Command Function
cd change directory
cp copy files
file determine a file’s contents
ls list files or directories
ln make a link to a file
mkdir make a directory
mv move (rename) a file
rm remove a file
rmdir remove a directory
http://www.linux-tutorial.info