1: default shell: Korn Shell
2: ONC+ : Open Network Computing
3: NIS : Network Information Service provides network information name services to clients
4: change from command-line login to X ,type "exit" then then press Return
5: ls -F check the file or directory type.
6: cp -i prevent overwritting existing files.
7: vi -R open file in read-only mode. vi -r to recover file..
view = vi -R view filename view file in read-only mode .
8:
useradd -u 512 -g 1 -c 'SA-Xu, Collin' -d /export/home/xcollin -m -s /usr/bin/bash xcollin
9: In solaris system, change the ip address: edit below three files /etc/inet/hosts /etc/inet/networks /etc/inet/netmasks
10: vi usage,
delete the specified line :5,18d delete 5 to 18 lines.
U undo all the changes at the current lin.
u undo the previous change.
:2,5 co 8 copy line 2 - 5 and put them after line 8.
:3,7 m 10 move line 3 - 7 and put them after line 10
:set ic search ignoring case
:set noic search to be case sensitive.
:set all displays all the set argument.
to create an automatic customization for all of your vi sessions, complete the flowing commands. (also applying for linux.)
1) create a file in your home directory called .exrc
2) enter the set variable without preceding colon.
11: ls [a-d]* list all files started with a - d.
ls [bp]* list all files started with b or p
ls -n lists detail information like ls -l. but show the uid and gid instead of owner's name.
-rw-r--r-- 1 512 1 270 Nov 8 11:13 dat
12: umask file default value 666 directory default value 777
if the umask is 022 then the new file default value is 644 new directory value is 755
you can't create a default file value 777. the most privilege you create a file is 666.
13: grep
grep -i search for both uppercase and lowercase characters
grep -n display the line number in the file.
grep -c count the lines that match the pattern
grep -v display the lines that do not match the pattern
grep -w search for the expression as a complete word. ignoring substrings meet the expression.
grep -l to search the names of the files that contain the pattern
grep '^no' /etc/passwd to find all the lines that begin with the letter 'no' in /etc/passwd file
grep 'A...n' /etc/passwd grep the line that start with 'A' then follows 3 charactor, then end with 'n'
grep 'adm$' /etc/group grep
lines that the end of lines is 'adm'
egrep : extended grep
egrep '[a-z]+body' /etc/passwd To search for all lines that have words followed by 'body'
egrep '(Network|uucp) Admin' /etc/passwd To search lines that contain 'Network Admin'or'uucp Admin'
14: find
find -atime +5 files that have not been accessed for more than 5 days.
find -atime -5 files that have been accessed in 5 days.
find -mtime +5 files that have not been modified for more than 5 days
find -mtime -5 files that have been modified in 5 days
15: parent process and child process
when one process creates another,the first process is considered to be parent process,the new process
is called the child process.
while the child process runs, the parent process waits.when the child process finishes its task, it informs the parent process,the parent process then terminates the child process.
16: ps -ef
UID PID PPID C STIME TTY TIME CMD
root 291 1 0 OCT 23 ? 0:18 /usr/lib/saf -t 300
UID: user name of the owner process
PID: the process id
PPID: the parent process id
C:cpu utilization for scheduling.(Not used now)
STIME:the time the process started
TTY:the controlling terminal for the process. '?' indicates that the process started without use of a terminal
TIME:the cumulative execution time for the process
CMD: the command name
17: pgrep
pgrep -l ssh pgrep -lf ssh
948 sshd 948 /usr/lib/ssh/sshd
2967 sshd 2967 /usr/lib/ssh/sshd
2966 sshd 2966 /usr/lib/ssh/sshd
pgrep -lt pts/2 display the terminal pts/2's process (must be 'lt' not 'tl')
pgrep -lU root displays the root's process (U=user) (must be 'lU' not 'Ul')
18:job
a job is a process that the shell can manage.Because jobs are processes,so each job has an associated PID. The shell also assigns each job a sequential job ID number.
jobs list the current jobs
fg %n bring a background job to run in the foreground n is the job ID not the pid
bg %n bring a foreground job to run in the background First you need to press ctrl+z to stop the foreground process,then you use bg %1 to let the command run in b
ctrl+z stops a foreground job.
kill %1 terminate job 1
19:function
typeset -f list all functions
use one command to execute a series of command. you can use the following three methods.
1): alias alias info='uname -a; id; date' info
2): function function infor { uname -a; id; date; } infor (before date, there's a semicolon)
3): shell script
20:set
set -o show current option settings.
set -o noclobber set noclobber option on
set +o noclobber set noclobber option off
21: jar
the usage equals to tar, jar package file and compress it.
jar cvf file.jar file
jar xvf file.jar
----------------------------------------------------------------
compress -v filename file.Z compress file -v option shows the percentage compressed
zcat file.tar.Z|tar xvf - view file.tar.Z without uncompressing it.
uncompress file.tar.Z restore file
------------------------------------------------------------------
another command to compress files : gzip
gzip file.tar ----> file.tar.gz
gunzip file.tar.gz ---------> file.tar
gzcat file.gz view the file.gz
gzact file.tar.gz | tar xvf - view file.tar.gz
-------------------------------------------------------------------
zip: compress and archive files
zip file.zip file1 file2 file3... zip file 1 ,2 ,3 to file.zip
unzip file.zip unzip file
unzip -l file.zip view file.zip
22: rlogin
rlogin vszcdevload05
rlogin -l nagios vszcdevload07 use another user to login to host.
23:profile
add the environmental variable
1:edit /etc/profile
2: add this two line
PATH=$PATH:/usr/sfw/bin:/usr/ccs/bin:.
export PATH
3:check PATH
echo $PATH
edit specified user's profile,for example edit oracle's profile
1:ls -a
2:vi .profile <!--WizHtmlContentEnd-->
24: time zone configuration command (both for linux and solaris)
tzselect