Topics Map > Computing > linux
Topics Map > Computing > research

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.
  • man command : Gives information from the UNIX manual about command. Text is displayed using less(below).
    Also, man -k word will list manual pages whose titles contain the keyword word.
  • Ctrl+C : 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.
  • Ctrl+Z : This control code temporarily suspends a command, whereupon the shell can accept the next command. Use the fg (foreground) command to get the suspended process running again; type jobs to see if you have any suspended or background processes. Or use the bg command to have the last suspended job run in the background.
  • date :Displays the current date and time.
  • finger name : Looks up the user information of the user matching name, e.g. finger Gilfong will return a list of users matching whose first name, last name, or username match Gilfong.
  • 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.
  • gunzip file :The inverse of gzip: restores the original file.
  • hostname : 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 mybustedscript
  • less : Displays text files one page at a time. Press "h" for help, "q" to quit", SPACE to go to the next page, "b" for previous page, "/" to search, etc.
  • logout : Ends your session.  If you ran multiple shells you may need to run this for each nested process. CTRL-D from a shell prompt does the same.
  • locate file : gives the location of file based on the contents of a database which is updated nightly. 
  • nice -prior program : Gives program 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.
  • passwd : 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 | less lists files in the current directory and views the results in a paginated form
  • uptime : Shows the load on the computer you are currently using.
  • who : Lists all users on the computer in which you are currently working.
  • whoami : Tells who is currently logged on a specific terminal


Keywords:
commands, linux, command line, resources 
Doc ID:
114561
Owned by:
Erik M. in UW Math Department
Created:
2021-10-28
Updated:
2024-12-02
Sites:
UW Math Department