UNIX Commands
Total Page:16
File Type:pdf, Size:1020Kb
UNIX Commands CIS 218 Advanced UNIX Commands (UNIX) • File/Directory information ls LiSt. Shows contents of current directory. cd Change Directory mv MoVe. Moves a file (leaves no copy). cp CoPy. Like mv, but leaves a copy. mkdir MaKe DIRectory rm ReMove. Delete, cannot be undeleted. rmdir ReMove Directory pwd Print Working Directory chmod Change permissions. du Disk Use. Shows totals in kilobytes. Commands (UNIX) • System Information w Who. Lists users, login times, and status. who Lists users, and login sites. finger Shows personal information. date Shows current date and time. uptime Shows system status, and load averages. man MANual pages. Complete online reference. ps ProceSses. Show programs are being run. top Shows top users of CPU and RAM (see also ps -aux and vmstat) df Display filesystem information uname Display UNIX information vmstat virtual memory statistics Commands (UNIX) • Task Management nohup 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 at low priority) a program kill Terminate a stopped program jobs List all running or stopped programs. & Run in background (append at program start). Commands (UNIX) • File Manipulation cat displays file text on STDOUT cut displays designated fields/characters echo displays string on STDOUT expand converts tabs to spaces file display info about a file find Locate file by name (find fmt simple text formatter fuser File user grep displays that match a pattern head 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 more display text a page at a time nl numbers lines od displays octal, decimal, hex dump of file paste merges lines from two files sort sorts lines in a file stat Display file inode info (metadata). See also ls –I, find –inum. strings displays text strings in a binary file tac displays text in reverse order tail displays designated number of lines from bottom of file touch update file timestamp info, create file if it doesn’t exist tr translate utility unexpand converts spaces to tabs uniq displays unique sequential occurences of lines uuencode, uudecode See also base 64 command wc 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 .