linuxcommands

Page 1

Page 1

LINUX CONSOLE COMMANDS

Help Commands Command command –help man command

info

Use/Description Lists general information about the command, including switches Lists the page from the built-in manual about the command. This contains very detailed information about the command. Displays information and documentation on shells, utilities and programs.

Directory and file location commands Command Use/Description cp source destination Copies a file from source to destination mv source destination Moves a file from source to destination. Also renames file source to destination. rm filename Deletes (removes) a file rmdir filename Deletes (removes) a directory mkdir filename Creates (makes) a directory ls Lists the contents of a directory ln existingfile new-link Creates link to an existing file (hard link) ln –s existingfile new-link Creates link to an existing file (soft link)

A “cheat sheet” of the most commonly used commands in Linux


Page 2

LINUX CONSOLE COMMANDS File processing commands Command grep string filename(s) head [-n] filename tail [-n] filename diff filename1 filename2 file filename cat filename sort filename vi [filename] pico filename emacs filename find directory switches filename otherswitches locate filename

Use/Description Looks through filename(s) for a string Displays the first 10 lines of filename. If –n is specified, displays the first n lines of filename Displays the last 10 lines of filename. If –n is specified, displays the last n lines of filename Displays the differences between filename1 and filename2 Displays the information about file contents Displays the contents of a file in the terminal. Displays and sorts the contents of a file Opens the vi editor Opens the pico editor Opens the emacs editor Finds the location of a filename starting from directory. Does more than locate, such as: delete files, change owners, display by permission, etc. Finds the location of a filename

Other helpful commands Command clear whoami echo string date cal whereis command who startx

Use/Description Clear the screen List who is logged in the session Copies string to a terminal List the current date and time Display a calendar Displays a command’s location in the directory structure List currently logged in users Goes from command mode to graphical mode

A “cheat sheet” of the most commonly used commands in Linux


Page 3

LINUX CONSOLE COMMANDS File compression commands Command tar switches filename filesToCompress gzip switches filename compress filename zcat filename

Use/Description Depending upon the switches value, combines (but NOT compresses) a list of filesToCompress into a filename, or extracts the files in the filename Compresses (and decompresses) the file Same as gzip Displays the contents of a compressed file

Standard input and output information Command Use/Description command1 | command2 command > filename command < filename command >> filename

Send the standard output from command1 to command2 Send the standard output from command to the filename Use the data from the filename as the input for command Append the output from command to the file

Special characters Command * ?

Use/Description Wildcard (one or more characters) Wildcard (one character)

Printing commands (lpd) Command lpr filename lpq queuename lprm filename

Use/Description Sends filename to the printer Lists files in the printing queue Removes file from the printing queue

A “cheat sheet� of the most commonly used commands in Linux


Page 4

LINUX CONSOLE COMMANDS File and system administration commands Command Use/Description quota passwd dmesg W mesg y/n write user talk user chmod permissions filename chown user filename su username vmstat free nice param jobnameOrOwner top bg %jobnumber fg %jobnumber kill PID ps df jobs fdisk mkswap mount mountSystem useradd groupadd usermod groupmod userdel groupdel fsck

Displays disk usage and limits Changes the password Displays kernel ring buffer Lists currently logged in users with processing usage Allows users to send messages to you Send a message to another user Allow two way chat to other users Change file access permissions Changes the owner of a file Log in as another user without closing the session List virtual memory usage List information like the amount of RAM and virtual memory usage Changes the priority of a job Views processor usage Moves job to the background Moves job to the foreground Stops a job from running Lists the jobs that are running and have run Lists all mounted file systems Lists all the current jobs Partition management utility Format a swap partition Mount a disk to the mountSystem Add a new user Add a new group Change information about a user Change information about a group Deletes a user Deletes a group Similar to Windows command chkdisk, it checks the disk for errors and fixes any surface errors

A “cheat sheet� of the most commonly used commands in Linux


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.