UNIX Commands

CIS 218 Advanced Commands (UNIX)

/Directory information

LiSt. Shows contents of current directory. Change Directory MoVe. Moves a file (leaves no copy). CoPy. Like mv, but leaves a copy. DIRectory ReMove. Delete, cannot be undeleted. ReMove Directory Print Working Directory Change permissions. Disk Use. Shows totals in kilobytes.

Commands (UNIX)

• System Information

w . Lists users, login times, and status. who Lists users, and login sites. finger Shows personal information. date Shows current date and . Shows system status, and load averages. man MANual pages. Complete online reference. ProceSses. Show programs are being run. top Shows top users of CPU and RAM (see also ps -aux and vmstat) Display filesystem information Display UNIX information vmstat virtual memory statistics Commands (UNIX)

• Task Management

Process runs after logging out (stdout to nohup.out) ^C Standard interrupt ^D End of Text (EOT) ^Z Stop current program fg ForeGround (resume) a program bg BackGround (resume low priority) a program Terminate a stopped program jobs List all running or stopped programs. & Run in background (append at program start).

Commands (UNIX)

• File Manipulation

displays file text on STDOUT displays designated fields/characters displays string on STDOUT converts tabs to spaces file display info about a file Locate file by name (find simple text formatter File user displays that match a pattern displays designated number of lines from top of file less display text a page at a time ls list file info lsof list open files display text a page at a time numbers lines displays octal, decimal, hex dump of file merges lines from two files sorts lines in a file Display file inode info (metadata). See also ls –I, find –inum. displays text strings in a binary file tac displays text in reverse order displays designated number of lines from bottom of file update file timestamp info, create file if it doesn’t exist translate utility unexpand converts spaces to tabs displays unique sequential occurences of lines uuencode, uudecode See also base 64 command counts characters, words, and lines

Commands (UNIX)

• Redirection

> Redirect output to a file >> Append output to a file 2> Redirect errors to a file < Send file as input << HERE" redirection in a script | “Pipe" – STDOUT of one command to STDIN of next command Commands (UNIX)

• Other

clear Clears the screen lpr Print lpq Check print queue lpstat Check print statistics rlogin Remote login rsh Remote Shell tar Tape ARchive. gzip Compress/Decompress files (.gz extension) compress Compress/Decompress files (.Z extension) gcc C compiler