Download presentation
Presentation is loading. Please wait.
Published bySibyl Bennett Modified over 9 years ago
1
Administration Utilities Objectives –to use standard administration utilities Contents –manual pages –identifying your system –communicating with Users –finding files –looking at files and logs –system defaults –Syslog –Logrotate –logserver Practicals –to become familiar with these commands Summary
2
On-Line Manuals $ man man $ man 1 intro $ man passwd $ man 4 passwd $ man man $ man 1 intro $ man passwd $ man 4 passwd On-line manuals in many sections: May vary on systems 1user commands4 file formats (8)1Mmaintenance commands5 miscellaneous 2system calls6 games 3functions and libraries7 special files man command displays first manual page found –some systems display all matched pages –add section number before command name to man command line Some systems provide a whatis database (originally BSD) –whatis command one line description of command –apropos command keyword search for command –/usr/ucb/catmanre-creates database from manual source files
3
Identifying the Unix System The uname command (uname) shows system information –the command hostname also identifies the current host options -aall information -nsystem name (nodename on network) -sO/S name -rO/S release number -vO/S version number -mmachine hardware -pprocessor type $ uname -a SunOS mash4077 5.4 generic sun4c sparc $ hostname mash4077 $ uname -a SunOS mash4077 5.4 generic sun4c sparc $ hostname mash4077
4
Identifying active users The who command shows who is currently logged on –information kept in /var/adm/utmp –a history of every login is also kept in /var/adm/wtmp Who can also be used to identify the current user who am i The command id also identifies the current user some systems also have a w command (originally BSD) $ who trapper pts001 Jul 25 11:01 hawkeye console Jul 25 11:31 $ who am i hawkeye console Jul 25 11:31 $ id uid=318(hawkeye) gid=300(users) $ who /var/adm/wtmp history of all system logins $ who trapper pts001 Jul 25 11:01 hawkeye console Jul 25 11:31 $ who am i hawkeye console Jul 25 11:31 $ id uid=318(hawkeye) gid=300(users) $ who /var/adm/wtmp history of all system logins
5
Talking to users Use write to display a message on a user's terminal –user's can disable messages using mesg n command –root can always write to a user Write all (wall) will display to all logged in users –useful for sending out broadcasts –used by the system shutdown mechanism Use the talk command to set up a two way dialogue. Use the telephone $ write trapper Do you know where the system logbook is? ^D $ mesg is no $ mesg y $ write trapper Do you know where the system logbook is? ^D $ mesg is no $ mesg y $ talk trapper
6
Finding Files The find command locates files using specified search criteria find directories... search_criteria... action Search Criteria: -name name finds only files called name (can use shell wildcards) -user name finds only files owned by user name -type letter finds files of specified type:f (plain files) d (dirs), etc. -mtime n finds files modified n days ago, less than (-n ), greater than (+n ) -size n[c|K] finds files of size n, larger than (+n ), smaller than (-n ), c=chars, K=kilobytes (when omitted, 512 block size is implied) -newer pathname finds files newer than specified file -mount don't cross disk boundaries Action: -print print filenames found -exec cmd {} \; executes given command (filename will be given in place of {}) -ok cmd {} \; executes command but prompts for confirmation
7
Exercise - Revision Of Using find What do the following find commands mean? # find. -print # find /etc -type d -print # find /home -name.profile -exec pg {} \; # find /dev -type f -mtime -7 -exec ls -l {} \; # find /sbin /usr/sbin -name "user*" -exec ls -ld {} \; # find. -print # find /etc -type d -print # find /home -name.profile -exec pg {} \; # find /dev -type f -mtime -7 -exec ls -l {} \; # find /sbin /usr/sbin -name "user*" -exec ls -ld {} \;
8
The grep Family All grep commands provide pattern matching criteria for filtering lines containing a pattern fgrep [ options ] pattern [ files... ] –fgrep uses fixed (simple patterns) grep [ options ] pattern [ files... ] –grep uses "regular expressions" to define powerful pattern matching templates egrep [ options ] pattern|pattern [ files... ] –egrep uses extended regular expressions, allows multi-pattern search common options -v output non-matched lines -c output count of lines matched -i ignore lower/upper case -n mark each matched line with its relative line number
9
Exercise - Revision Of Using grep Always using single quotes round grep regular expression What do the following grep commands mean? # ls -l | grep '^d' # grep 'ksh$' /etc/passwd # ls -a | grep '^\.[^.]' # fgrep root /var/adm/sulog # who | egrep '(hawkeye|trapper)' # ls -l | grep '^d' # grep 'ksh$' /etc/passwd # ls -a | grep '^\.[^.]' # fgrep root /var/adm/sulog # who | egrep '(hawkeye|trapper)'
10
Looking Inside Files Use the file command to identify a file type Then for: Text files: use pg or more to look at the file Data files: use octal dump (od) –some systems supply a hex dump (hd) program –use the -c option to characters where possible Use the strings command to list ASCII strings in a data file # file * feed.dat: ASCII text myprog: iAPX 386 executable not stripped myprog.c: C source code runsys: commands text x.jpeg: data # od -c x.jpeg | pg # file * feed.dat: ASCII text myprog: iAPX 386 executable not stripped myprog.c: C source code runsys: commands text x.jpeg: data # od -c x.jpeg | pg
11
Inspecting Log Files Use a pager such as less or more –can be slow when working with large log files Use grep to look for particular words Use the tail command to look at the last few lines –if the log file is growing than use the -f option Use view (vi read only) to read the whole file Whatever method you choose: DO LOOK AT LOG FILES # tail /var/messages SU 07/17 23:47 + console root-lp SU 07/18 00:37 - console alina-root # tail /var/messages SU 07/17 23:47 + console root-lp SU 07/18 00:37 - console alina-root
12
System Default Files & logbooks RedHat sysconfig /etc/sysconfig/ –Redhat specific setup and boot files General linux config /etc/ –Many files, system wide configs Adduser enviroment /etc/default –When adding users, this apply in first line –Also /etc/skel is added to user enviroment RedHat system logbooks Undependent of syslog: /var/log/maillog : Mail /var/log/httpd/access_log : Apache web server page access logs RedHat log catalog standards: /var/log/messages: (SYSLOG) Systems services & hardware log /var/log/samba/ : Samba messages /var/log/secure : Login details, ftp, pop, imap and so on.. /var/log/vsftpd : Very secure ftp server
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.