Friday, July 1, 2011

Some Linux Commands

The original page went down around 2007. It belonged to Clark College Linux User Group. Found it in the waybackmachine.org
You can check out this. The link redirects to the archive where the page is stored.
Use  man command for more information on the commands.
Console Commands
Utility or CommandUse/Description
passwdChanges password
nslookupQueries Internet domain name servers
quotaDisplays disk usage and limits
motdMessage of the Day
finger usernameUser information lookup program
man or xman commandDisplays pages of online manual
xmanDisplays System Manual in X
less filename or morefilenameDisplays the contents of a file in the terminal one page at a time
infoDisplays information and documentation on shells, utilities and programs
clearClears the terminal window
ls directoryList contents of a directory
cat filenameDisplays the contents of a file in the terminal
rm filenameRemoves a file
pico filename or emacsfilenameOpens and edits text files
cp sourcefile detstinationfilenameCopies a file
lpr filenameSends file to printer
grep string filenamelooks through files for strings
head filenameDisplays first 10 lines of file
tail filenameDisplays last 10 lines of file
mv existingfilename newfilenameMoves or renames file
lpq filenameDisplays files in printing queue
lprm filenameRemoves file from printing queue
sort filenameDisplays and sorts file contents
diff filename1 filename2Displays differences between files
file filenameDisplays information about file contents
echo stringCopies string to terminal
dateDisplays current date and time
calDisplays calendar
gzip filenameCompresses a file
compress filenameCompresses a file
gunzip filenameDecompresses a compressed file
zcat filenameDisplays contents of a compressed file
apropos commandLists all man page titles/headers that contain the command
lynxText based web browser
dmesgDisplays kernel ring buffer
which commandDisplays path to command
whereis commandDisplays paths to locations of commands
whoLists currently logged on users
finger username@hostnameObtains detailed information about a user currently using the system
wLists currently logged on users with processing usage
mesg y/nSets options for letting other users write you messages
write userSends message to other users
talk userAllows two way chat to other users
chmod permissions filenameChanges file access permissions
mkdir directorynameMakes a directory
rmdir directorynameRemoves an empty directory
ln existingfile new-linkCreates link to an existing file (hard link)
stat filenameLists information about a file
ln -s existingfile new-linkCreates link to an existing file (soft link)
dfDisplays all mounted filesystems
psReports process status
command &Sends a job to the background (job: one or more commands connected by a pipe "|" or pipes) The operating system assigns a number to the job when you press return. example: [1] 3578
topDisplays updating list of currently running processes
ttyDisplays the name of the terminal in which the command was issued
command filenameRedirects standard output 
command < filenameRedirects standard input
cat file1 >> file2Appends standard output from file1 to file2
cat /dev/null > filename orfilename > /dev/nullRedirects "bit bucket" or null string to file (only superuser has write access to this file)
command1 | command2Pipe sends standard output of one command to the standard input of another command
tr string1 string2 < inputfiletranslates each character in string1 to the corresponding character in string2
command | tee filename |grep stringSends the output of one command to standard output and a file
bg %job numberSends job to the background by job number
fg %job numberBrings job to the foreground by job number
kill PID or %job numberAborts a process by PID (Process Identification Number) or job number
jobsDisplays a list of current jobs
netcfgUtility to set up PPP and network configurations
xevUtility used to see information flow from X server to client
echo $DISPLAYEnvironment variable that displays the ID string for a window
echo $PATHVariable that displays executable path
netstatDisplays network connections
viewresGraphical class browser for X
xbillGame featuring Bill Gates trying to put windows on Macs and NeXT workstations
xevilGame similar to Loderunner?
xchompLinux's version of PacMan
xcmapStrange color lookup utility
xeditText editor for X
asclockClock from AfterStep
xconsoleStrange console for X
xmessage messageSends message to a dialog box
xgalXGalaga game
xg3Image viewing program
xgcGraphing calculator?
xjewelJewel game for Linux
xkbvledsLEDs?
xkbwatchLEDs?
xlogoDisplays X logo
xmixerOpens system sound controls
xsnowSnowflakes are fallin' on your desktop
xwininfoDisplays info about a window
startxStarts an X Window System server
ghostviewStarts a text preview application
xv filenameImage viewer
xsetroot -colorSet background color in X
xcalcStarts a calculator in X
xclipboardStarts a clipboard in X
traceroute hostPrints the route packets take to the host
hostnameDisplays system identity name
rlogin hostUtility to connect to a remote system
telnet hostUtility to connect to a remote system (similar to rlogin but more interactive)
rcp file remotemachineUsed to copy from a remote computer
ftpUtility to transfer files between systems on a network
rsh commandUtility to run a command on a remote system without logging in
ping hostUtility used to test connection to a remote system
lcd directorypathChanges local machine directory while logged on to remote machine


Shared Directories
DirectoryDescription
/Root - The root directory is present in all Linux system file structures. It's the parent of all files in the system.
/binEssential common binaries - Holds files needed to boot the system and run it when it comes up in single user mode.
/bootStatic files of the boot loader.
/devDevice files - All files that represent peripheral devices.
/etcMachine-local system configuration - Holds administrative, config, and other system files. Holds /etc/passwd file that contains a list of all users who have permission to the system.
/homeUser home directories - Contains each user's or client's home directory
/libShared libraries
/mntMount point for temporary partitions
/procKernel and process information (virtual filesystem)
/rootHome directory for root
/sbinEssential system binaries - Contains utilities for system administration.
/tmpTemporary files
/usrSecond major hierarchy - Includes subdirectories that contain information used by the system.
/varVariable data - Contains files whose contents change as system runs.

vi Commands
CommandDescription
vi filenameStarts vi and creates a new file
:q!Quits vi without saving work
pPastes data in buffer below current line
PPastes data in buffer above current line
yyCopies current line
:r !commandReads in output of the command
iPuts vi in insert mode
:set autoindentSets vi to indent automatically
:set showmatchSets vi to show matching parenthesis
:set nuSets vi to display line numbers
:set showmodeSets vi to display the mode you're in
ESCAPESets vi to command mode
Control-UErases current line (insert mode)
Control-HErases on letter (insert mode)
Control-WErases current word (insert mode)
h, j, k, lMoves cursor left, up, down, right respectively
uUndoes last action
xDeletes a single character
dwDeletes a single word
ddDeletes a single line
ZZWrites work buffer to disk and exits vi
oinserts line after cursor position
Control-LRedraws screen
:w filenameSave work as filename and exits

Control Characters
KeyUse
Control-H or BACKSPACEErases a character on the command line
Control-UDeletes an entire command line
Control-WErases a word on the command line
Control-CAborts program execution
COMMAND-TabSwitches Programs
Control-L or CONtrOL-RRefreshes the screen
Control-Dlogout or exitLogs you off the system

No comments:

Post a Comment