Unix Commands: (a working command set) Prof. Michael P. Harris, CCNA, CCAI ITSC1405 – PC Operating Systems adduser, useradd used by root to add user to system. Usage: adduser userid alias, unalias assign name to specified command list. e.g. create a macro command ash, bsh a shell, a very simple shell program sometimes used on boot diskettes. at executes a shell script at specified time. Usage: at [-f] file time atq, atrm atq shows, and atrm removes, pending jobs queued by at. awk, gawk, nawk searches for and process patterns in a file. A shell scripting language. banner print banner to standard output. Usage: banner [option] [characters] bash Bourne Again SHell. This is the default shell in most Linux installations bzip, bzip2 compresses files with an algorithm different from gzip. bunzip, bunzip2 used to uncompress files compressed with bzip. bzless view bzipped files cc, c++ invokes C and C++ program compilers. See also gcc, g++, yacc cal displays a 12-month or a one-month calendar. Usage: cal [month] year cat concatenate/combine stdin to stdout. Used to join or display files. cd change working directory. Usage: cd path, cd –or- cd ~, cd .. cfdisk similar to fdisk, but menu-driven. See also fsck chmod set permissions (access modes) of files or directories. See also umask chgrp changes the group associated with file. Usage: chgrp [-R] group files chown changes the user-ownership of a file. Usage: chown [-R] userid files chsh change default shell. See also: sh, ash, bash, csh, ksh, tcsh clear clear screen command (tput clear) cmp compares two files for differences. See diff, diff3, uniq comm compares sorted files compress compress (uncompress) files to the older .Z file format. See gzip, zcat cp copies on or more files. Usage cp [-r][-p] source target[directory] crontab schedules command to run at regularly specified time. See also at. csh the C shell, See also ash, bash, ksh, and sh. csplit separate files into sections. See also split, cut, paste. cut selects characters or TABed fields from files/lines of input. See paste date displays or sets date and time. See also time. Usage: date [date] df displays disk free space & disk capacity in blocks on physical devices. diff diff3 displays differences between two files. See also: cmp, comm, uniq compares three files and reports on differences du displays information on disk usage & file sizes. Ex. du / -bh | less echo write arguments to standard output. Ex. echo $PATH, echo ~ emacs a very powerful screen oriented text editor. env, printenv display or set to a new value, the environmental setting variables. eval scans and evaluates the command line. See also: let, expr, test ex interactive command-based editor. See vim, an improved version of vi. exec system call which creates a subshell to execute a binary or a script. exit exit (terminate) a command-line shell. expand convert tabs in files to spaces and write to standard output. export place the value of a variable in the set environment (makes it global). expr evaluate an expression and displays the result. See also: let, eval, test false null command that returns an unsuccessful exit status. See also true fc views, edits, and executes commands from the shell history list. fdisk utility used to partition hard drives. See: cfdisk. Usage: fdisk device file displays classification of a file(s) based on the type of data within. find find files matching a large variety of search criteria. Ex. find . –type d finger display information about a specified userid or userids. See also: id fmt simple text formatting utility. Makes lines the same length. See pr fold break lines of files so they are no wider than a given length. See fmt free gives used/free system memory along with other useful information. fsck File System Check and Repair. ftp file transfer (protocol) over the network. gcc, g++ invoke the GNU C or C++ compiler. See also cc, c++, yacc gawk, nawk GNU awk, mostly for processing delimited text files gimp a very powerful image manipulation and paint program grep, fgrep, egrep find a string or pattern within a file(s). Usage: grep pattern files groupadd create a new group on the system. groups shows which groups you are in. grub GNU GRand Unified Bootloader. Boot multiple OSs. See also: lilo gvim GNU Vi IMproved. See also: vi, view, and vim gzip, gunzip utility used to compress or uncompress files. (.tar.gz or .tgz) halt shut down system as root, without reboot, immediately. See shutdown Unix commands: ITSC 1405 – PC Operating Systems Page 2 of 6 hash remembers the location of commands in the search path. head displays first part (10 lines default) of a file. See tail history command for viewing and manipulating the shell command history list host look up host names using domain server. See also: hostname, uname hostname used to get/set the hostname (computername). See /etc/HOSTNAME id display your userid and groupid. See also: logname, groups, whoami inetd daemon which starts other daemons on demand. See /etc/inetd.conf ifconfig display information on network interfaces that are currently active. ifdown shut down the network interface. Usage: ifdown [interface_name] ifup start up the network interface. Usage: ifup [interface_name] info display system information. This is the GNU hypertext reader. init master process, runs at bootup, executes commands in /etc/inittab jed, joe, jove programmer's text file editors, have emacs emulation modes. kill sends a signal to terminate a job or process. Ex. kill -9 pid ksh Korn shell. See sh, ash, bash, and csh ldd list/locate the shared libraries on which a given executable depends. less improved more command. Displays text files, many options. See pg let evaluates a numeric expression & assigns answer. See: expr, eval, test lilo LInux LOader, installs a boot loader on the boot sector of a device. ln creates a link to a file. Used to create hard links and -s symbolic links. locate find file(s) that that match a pattern, easier syntax than find. login login to the Unix/Linux operating system. See also: logout logname consult /etc/utmp for user's login name. See also: id, hostname logout execute logout as individual user and bring up login: prompt look look for strings in files, See grep lpr send file to be printed, used with pr. See also lp lpq show print jobs that are waiting lprm cancel a job from print queue ls list directory contents. ls –al, ls –color=auto, ls –FAC, ls –FRAC, ls –Fskb make keeps a set of programs current, works by executing a script makefile. man , --help displays information from online Unix reference manual. See: whatis mc Midnight Commander file manager and visual shell mkdir make (create) a directory. See also: cd, rmdir, rm –rd, mv mkfs make (create) a file system (format) on a device or partition. See dd Unix commands: ITSC 1405 – PC Operating Systems Page 3 of 6 mkswap creates a Linux swap space on the specified hard disk partition. more list file contents, stopping after each full screen. Q exits. See less, pg mount , umount mount a device as a directory in the filesystem. See also: /etc/fstab mv moves (renames) files/directories. netconf used (as root) to set up the network. See also: ifconfig nice sets the priority of a program. Usage: nice program_name od dumps contents of a file. passwd change login password. paste joins corresponding lines from files. See cut, split pathchk determine validity and portability of filenames. perl Practical Extraction and Report Language pg display data one screenful at a time. See more, less pico simple screen oriented text editor. See also nano ping check if an Internet computer is responding (online). See traceroute pr paginates files for printing, used with lpr. See also fmt ps displays processes status. Usage: ps -a for all processes. See kill, top pstree display processes in the form of a parent/child tree structure. pwd print absolute path of the working (current) directory. python interpreted, interactive, object-oriented programming language rcp copy one or more files to or from a remote computer. See rsh, rlogin read reads line from standard input. See echo rlogin log in to remote computer. Ex: rlogin -l userid mercury.delmar.edu rm remove files or (-rd) directories. Usage: rm [-r] [-rd] filepath rmdir remove empty directories. See also rm –rd rmuser remove user account from the filesystem. See also: userdel, adduser route show the routing table entries. Usage: route [-n] rpm invokes the Redhat Package Manager in command line mode. rpm2tgz an extremely useful utility that converts rpm packages to tgz format. rsh execute shell command on a remote computer. See rcp, rlogin, & ssh rxvt a terminal program like xterm, has less features/uses less memory. sed edits a file (stream/redirect). Also a tool for processing text files. set, setenv set or display value of shell variables. See also env, export, let sh standard UNIX Bourne shell. See also: ash, bash, csh, and ksh shutdown reboot or shut down system as root. shutdown [-h] [-r] minutes Unix commands: ITSC 1405 – PC Operating Systems Page 4 of 6 sleep creates process that sleeps for specified interval. See also: wait sort sorts and/or merge files. split split file into specified number of segments. See also csplit, cut, paste ssh secure shell with security and encryption. See telnet, rlogin, rsh startx frontend to xinit (xterm) starts X-clients/ X-server window managers. su simulate user. log in as another user, including root (super user). sudo Super User DO, gives users root permission to perform specified tasks. swapon, swapoff enables or disables swap disk usage. symlinks provide list of and information about symbolic links. See ln -s sync writes memory buffers to physical devices for safe removal. tail displays the last part (default 10 lines) of a file. See head tar tape archive, file compression/archiving utility. tar [–xvf] [-cvf] file.tar tcsh extended version of the C shell, csh tee copy standard input to standard output and to one or more files telnet remote login over the network. See also ssh, rsh, rlogin test evaluates an expression or compares arguments. See expr, eval tftp user interface to TFTP (trivial FTP) protocol. See also: ftp, rcp time displays times for the current shell and its children. See also date top dynamically displays process status. See also ps, kill touch create an empty file or update access and modification times of a file. tr translation utility, replace specified characters in a text file. true a null command that returns a successful exit status. See false tty shows special file that represents your terminal & terminal pathname. umask establishes the file-creation permissions mask. Usage: umask xyz umount finish writing to the device and remove it from the active filesystem. uname displays information about the OS system. Usage: uname [-a] uniq displays lines of a file that are unique. See also diff, cmp, comm unzip uncompress files compressed with zip, compatible with DOS PKzip uptime shows the time, system up time, number of users, & average load. userdel remove an account (as root). The user's home directory is not deleted. users prints list of users on the system. See also who, whodo vdir variant of the ls command. Defaults to printing the long listing. vi Unix commands: standard screen oriented Unix editor. See also: vim, gvim, and view ITSC 1405 – PC Operating Systems Page 5 of 6 view vi in read-only mode vim Vi IMproved, vi editor. See also: vi, gvim, and view wait waits for a background process to terminate. See also: sleep wc word count, displays number of lines, characters and words in a file whatis display one-line summary about a specified command. See also: man whereis used to find utilities/files in standard locations. which used to find utilities/files in the search path. who display information about currently logged in userids. See also: id whoami, who am i display information about userid that is currently logged in. See id xterm start an X-Window terminal session. See also: rxvt yacc parser generator. Yet Another C Compiler zcat read to stdout files that have been compressed with gzip or compress. zcmp read compressed files and pass them to cmp. zdiff read compressed files and pass them to diff. zgrep read compressed files and pass them to grep. zip, unzip zip compress/uncompress utility compatible with DOS PKzip zless view zipped files zmore print contents of compressed files one screen at a time znew uncompress .Z files (compress) and recompress in .gz (gzip) format. Unix commands: ITSC 1405 – PC Operating Systems Page 6 of 6