Whizlog



Common Unix Commands

Most commonly used UNIX Commands:

Terminal control characters for C-shell

  • ^h or backspace - erase previously typed character
  • ^u - erase entire line of input so far typed
  • ^d - end-of-input for programs reading from terminal
  • ^s - stop printing on terminal
  • ^q - continue printing on terminal
  • ^z - suspend currently running job; restart with bg or fg
  • ^c - kill currently running program and allow clean-up before exiting
  • ^\ - emergency kill of currently running program with no chance of cleanup

Authentication

  • login - access computer; start interactive session
  • logout - disconnect terminal session
  • exit - disconnect terminal session
  • passwd - change local login password; you must set a strong password that is not easily guessed

Information Commands

  • date - show date and time
  • history - list of previously executed commands
  • man - show online documentation by program name
  • info - online documentation for GNU programs
  • w, who - who is on the system and what they are doing
  • whoami - who is logged onto this terminal
  • top - show system stats and top CPU using processes
  • uptime - show one line summary of system status
  • finger - find out info about a user@system
  • whois - look up information in the Stanford Directory
  • env – information about the current session
  • uname – print name of current system

File management

  • cat - combine files
  • cp - copy files
  • ls - list files in a directory and their attributes
  • mv - change file name or directory location
  • rm - remove files
  • ln - create another link (name) to a file
  • chmod - set file permissions
  • crypt - encode/decode a file with a private key
  • gzip/gunzip - compress/decompress a file
  • find - find files that match specific criteria

Directory Management

  • cd - change to new directory
  • mkdir - create new directory
  • rmdir - remove empty directory (remove files first)
  • mv - change name of directory
  • pwd - show current directory

File Processing

  • cat - copy files to display device
  • more - show text file on display terminal with paging control
  • head - show first few lines of a file(s)
  • tail - show last few lines of a file; or reverse line order
  • vi - full-featured screen editor for modifying text files
  • grep - display lines that match a pattern
  • diff - compare two files and show differences
  • cmp - compare two binary files and report if different
  • comm. - compare two files; show common or unique lines
  • od - display binary files as eqivalent octal/hex codes
  • strings - show printable text embedded in binary files
  • file - examine file(s) and guess type: text, data, program, etc.
  • wc - count characters, words, and lines in a file

Space/Disk Usage

  • df - summarize free space on disk drive
  • du - show disk space used by files or directories

Special characters

  • * - match any characters in a file name
  • ~user - shorthand for home directory of user
  • $name - substitute value of variable name
  • \ turn - off special meaning of character that follows
  • - in pairs, quote string with special chars, except !
  • - in pairs, quote string with special chars, except !, $
  • ` - in pairs, substitute output from enclosed command

Controlling program execution for C-shell (See man csh)

  • & - run job in background
  • ^c - kill job in foreground
  • ^z - suspend job in foreground
  • fg - restart suspended job in foreground
  • bg - run suspended job in background
  • ; - delimit commands on same line
  • () - group commands on same line
  • ! - re-run earlier commands from history list
  • jobs - list current jobs
  • ps - print process screen
  • kill - kill background job or previous process
  • nice - run program at lower priority
  • at - run program at a later time
  • crontab – run program at specified intervals
  • limit - see or set resource limits for programs
  • alias - create alias name for program (in .login)
  • sh, csh - execute command file
  • sleep - delay for a specified amount of time
  • wait - Wait for the specified process

Controlling program input/output for C-shell (See man csh)

  • | - pipe output to input
  • > - redirect output to a storage file
  • < - redirect input from a storage file
  • >> - append redirected output to a storage file
  • tee - copy input to both file and next program in pipe
  • script - make file record of all terminal activity

Interpreted languages and data manipulation utilities

  • sed -stream editor
  • awk - pattern scanning and processing language
  • perl - Practical Extraction and Report Language
  • sort - sort or merge lines in a file(s) by specified fields
  • tr - translate characters
  • cut - cut out columns from a file

Networking/communications

  • ssh - remote login/command execution; encrypted
  • scp - remote non-interactive file copy; encrypted
  • sftp - remote interactive file copy; encrypted
  • telnet - remote network login – plain text password
  • ftp - network file transfer program – plain text passwords
  • rlogin - remote login to “trusted” computer that is not kerberized
  • rsh - execute single command on remote “trusted” computer
  • rcp - remote file copy to/from “trusted” computer
  • host - find IP address for given host name, or vice versa
  • tar - combine multiple files/dirs into single archive
  • uuencode, uudecode - encode/decode a binary file for transmission via email

Compilers, interpreters and programming tools

  • csh - command language interpreter (C-shell scripts)
  • ksh - command language interpreter (Korn-shell scripts)
  • sh - command language interpreter (Borne-shell scripts)
  • f77 - Compaq(HP) Fortran 77 compiler
  • f95 - Compaq(HP) Fortran 90/95 compiler
  • f2c - convert fortran source code to C source code
  • cc, c89 – Compaq(HP) ANSI 89 standard C compiler
  • cxx - Compaq(HP) C++ compiler
  • gcc - GNU C compiler
  • g++ - GNU C++ compiler
  • pc - Compaq(HP) Pascal compiler
  • dbx - command-line symbolic debugger for compiled C or Fortran
  • ladebug – X Window symbolic debugger for compiled C or Fortran
  • make - recompile programs from modified source
  • gmake - GNU version of make utility
  • cflow - generate C flow graph
  • error - analyze and disperse compiler error messages

Leave a Comment

You must be logged in to post a comment.