Topics Map > Computing > linux

Linux General Commands

This is a more generalized listing of different commands used in navigating and manipulating linux environments and programs.

General Commands
These commands are good to keep in mind when doing any sort of work on a UNIX computer.
Usually kills whatever you are doing and signals the shell to accept the next command. Use Ctrl+C only if you are stuck, since work you did during the killed command may be lost.
Usually typed by accident, this control code temporarily suspends a command, whereupon the shell can accept the next command. Use fg (foreground) to get the suspended process running again; type jobs to see if you have any suspended or background processes. Do not use Ctrl+Z unless you really intend to, particularly when editing files or reading mail, since you can easily get inconsistent versions or lose mail if you execute the command a second time without finishing the first one.
crypt input output
Encrypt or decrypt a file (it knows which way to go). It will ask you for a key. The algorithm is not sufficiently strong for national security issues.
Displays the current date and time.
finger name
Looks up the loginID of name.
e.g. finger Gilfong will give you the loginID (and full name) of everyone named Gilfong. Be prepared for a lot of output with common names. You can also specify the loginID to find the person's full name.
gunzip file
The inverse of gzip: restores the original file.
gzip file
Compresses file. The full-size file is removed and the compressed file has the same name with an extension of ".gz" added. You can get 4 to 1 compression on low-entropy data.
Gives the name of the computer on which you are currently working.
kill pid
Cancel the process with identification pid
pkill process
Cancel the named process - e.g. pkill firefox-bin will kill your firefox session. This is useful as firefox often refuses to die and you will not be able to start up a new session without killing the old one.
Ends your session. NOTE: you must logout every time you are finished at the terminal or other userss will be able to change your files. On office machines please do not leave idle sessions active overnight, both because of the security hazard and because the unused programs use up system resources. An alternative command is exit.
lpr filename
Prints filename to the default printer. You can change your default printer by typing setenv PRINTER N, where N is the number of the desired floor. To print filename to floor N, type lpr -PN filename. Save trees by viewing documents onscreen, and mind your paper quota.
lprm pid
Cancels the print job pid.
Also, lprm -PN pid cancels job pid on floor N.
Checks on status of print jobs on your default printer. 
lpq -PN checks print jobs on printer N. 
lprm -PN jobid will remove jobid from printer N.
locate file
gives the location of file.
man command
Gives information from the UNIX manual about command.
Also, man -k word will list manual pages whose titles contain the keyword word.
nice -prior job
Gives job job processing priority value prior (1 being the highest priority level and 19 the lowest) which tells the computer how to process tasks.
e.g. nice -19 ./a.out & runs the program a.out in the background at the lowest priority.
Changes your password. You will be asked to type the old password first, and then the new password twice. None of this is visible on the screen. 
command1 | command2
Called the “pipe” command. Takes the output of command command1 and uses it as the input for command2.
e.g. ls | lpr prints the names of the files listed in the cuurent directory.
Shows the load on the computer you are currently using.
Lists all users on the computer in which you are currently working.
Tells who is currently logged on a specific terminal

Keywords:commands, linux, command line, resources   Doc ID:114561
Owner:Erik M.Group:UW Math Department
Created:2021-10-28 13:28 CSTUpdated:2022-11-07 11:01 CST
Sites:UW Math Department
Feedback:  0   0