1-Grep Command : is used to search word in your file
2-Mount and Unmount directory or drive
3-set variable values
4-Begin code and end code
5-Export result to file
6-Exit from file
7-connect to mysql in linux
8 -connect to mysql in linux by example
9-To list the environment variables in terminal
10-what is $1
11-show ram size
12-list size of each directory
13-move directory or file
14-show CPU Infor
15-Top command to find out Linux cpu usage
1-Grep Command
Syntax :
Grep word_search Filename
Example:
grep Cambodia File1.txt
grep Cambodia F1*.* --> Search the word Cambodia with all file start with F1
2-Mount and Unmount directory or drive
Mount: mount -t nfs 192.168.1.1:/datamart_bk/mnt/datamart_bk/
Unmount: unmount -f datamart_bk
3-set variable values
export filename=filename_'/bin/date -d yesterday+%Y%m%d'.txt;
#export filename=filename_20140616.txt
Join variable
export file2="$filename"/logs -->filename/logs
4-Begin code and end code
<<EOF
script
EOF
5-Export result to file
>/A/B/C/$FileName
6-Exit from file
exit 0;
7-connect to mysql in linux
/usr/local/mysql/bin/mysql-u'xx' -p'yyy' -h192.178.11.11 --skip-column-names
8 -connect to mysql in linux by example
myscript.sh
export filename=mydoc.txt
/usr/local/mysql/bin/mysql-u'xx' -p'yyy' -h192.178.11.11 --skip-column-names <<EOF
>/A/B/C/$FileName
use databasename
select * from tablename
EOF
exit 0;
9-To list the environment variables in terminal
env
10-what is $1
$1 is the first commandline argument. If you run ./asdf.sh a b c d e, then $1 will be a, $2 will be b, etc. In shells with functions, $1 may serve as the first function parameter, and so forth.
11-show ram size
prtconf | head -3 |grep Mem (sun)
less /proc/meminfo (linux)
12-list size of each directory
du -kh (list size of directory that you are stand in)
du -kh * (for mount drive)
df -kh (list all main directory )
13-move directory or file
mv -f 01 02 03 /data/backup/ -->move dir 01,02,03 to data/backup
14-show CPU infor
cat /proc/cpuinfo -->linux
grep processor /proc/cpuinfo
-->linux
15-Top command to find out Linux cpu usage
$ top
No comments:
Post a Comment