70 likes | 174 Views
CIS 218. Utilities and Filters. UNIX Command Information. man(ual) page (or info) Info Expanded POSIX version of man, primarily a LINUX command whereis
E N D
CIS 218 Utilities and Filters
UNIX Command Information • man(ual) page (or info) • Info Expanded POSIX version of man, primarily a LINUX command • whereis finds the file for this command in the directory structure and usually finds the manual pages and source code too if they are available. It will look into a list of directories to find if there is an executable file by this name available niot limited to on the current command search path. • which finds the version of the file containing the directions for this command based on your current command search path will determine which one of the • whatis same as% man -f gives a short description of the command specified as the argument • apropos same as% man -k gives a list of commands that corresponds to the keyword argument
UNIX System Information • date: tells the current date and time • top: displays system process information • vmstat: displays system resource information • iostat: (some systems) displays system I/O information • uname: displays UNIX operating system info • hostname: displays/sets the name of the current host system. Only root can set the host name. • (r)uptime: displays (remote) system runtime info • cal: displays a calendar - 0 arg-current month and year, 1 argument = year, 2 arguments = month&year) • netstat: displays TCP/IP network statistics • ifconfig: displays system network interface information • du:Disk usage. Shows totals in kilobytes. • df:Filesystem usage. Shows totals in blocks, inodes.
User Information • who: displays information about all users currently on the system. The following information is displayed : login name, tty , date and time of login • who am I: displays your login name and time ,tty ,date and time you logged in. If the user is logged in from a remote maachine, the the host name of that machine is displayed as well • whoami: displays your login name. • finger name(@systemname): is a command used to find the information of the user at a specific system, nothing means find your own information • chsh: change default LOGIN shell (some systems) • chfn: is a command that allows you to change your own information. Some system adminiatrators store information such as the user's full name, phone,and office number. • W loginid: prints a summary of the current activity on the system that the specified user is doing.
UNIX Filters •cat: displays contents of a file (on STDOUT) • echo: copyies string to STDOUT • head: displays beginning records in a file (default 10) • tail: displays ending records in a file (default 10) • sort: sorts records of a text file in ASCII order • uniq:removes consecutive duplicate lines of a text file • cut: displays specific words/bytes/columns of records in a text file -dused to tell what the column delimiter is -f used to tell which words to select -c used to tell which characters to select -b used to tell which bytes to select • join: joins specific matching records in a file • paste: joins records in a file, delineated by tabs • colrm: extracts specified parts of a file by column # based on their character position. Two numeric arguments tell beginning and ending column numbers that should be removed (if only 1 number end is assumed) • wc: "word count“ counts # of characters, words and lines -lstands for just lines -wstands for just words -cstands for just characters
UNIX Filters • grep "global ‘regular expression’ filename". grep searches for the specified pattern displays each matching record. grep ‘regexp string’ filename • Filename follows normal filename expansion rules • ‘regular expression’ meaning the usual regexp parameters: • ^ - beginning of line • $ - end of line • . - replaced by any 1 character • [ ] - choose one from the class of characters in the set • [^ ] – negates the selection set • * - 0 or more of preceding character • ? – 0 or 1 of prededing character • + - 1 or more of preceding character • ‘ ‘ - quotes a string • \ - “escapes” the following character
UNIX Filters • find [/dir] –name filename –print –exec cmd {} \; • Locates files by filename anywhere in the directory structure starting at /dir. Within authirizations of the user ID issuesin the find command. • Filename follows normal filename expansion rules • If specified, -exec repetitively issues cmd against every matching file name found specified by {}.