1. How to obtain the PID using the script
See the script pid. sh as follows:
$ Cat pid. sh
#! /Bin/sh
Pid = 'ps-aux | grep $1 | grep-v grep | awk '{print $2 }''
Echo $ pid <$ 1.pid
$./Pid. sh sshd
2. Convert the file name from uppercase to lowercase.
See the mklower. sh script as follows:
#! /Bin/sh
For file in $1;
Do
Newfile = 'echo "$ file" | tr "[: upper:]" "[: lower:]"'
Mv "$ file" "$ newfile"
Done
$ Mklower. sh *. JPG
3. Sort subdirectories by size
$ Du-s * | sort-n
4. ls display color
$ Ls-G # display attribute color $ ls-F # display attribute characters $ ls-FG
5. Quick package installation
You can first set PACKAGEROOT to specify the package of the site, and automatically find the corresponding pakage during installation, and you do not need to know the version, as long as you know the package name, the latest package version will be automatically installed, add zh-to the Chinese text, such as zh-xcin.
# Setenv PACKAGEROOT ftp://ftp.tw.freebsd.org
# Pkg_add-r package_name
You can also directly specify the PACKAGESITE to point to a specific location. For example, the package you want to install is the latest, rather than the release version.
# Setenv PACKAGESITE ftp://ftp.tw.freebsd.org/pub/Fre... ages-stable/Latest/
6. Use an ISO Image
FreeBSD 4.X
# Vnconfig/dev/vn0c./IMAGE. ISO
# Mount-t cd9660/dev/vn0c MOUNT_DIR
# Umount MOUNT_DIR
# Vnconfig-u/dev/vn0c
FreeBSD 5.X
# Mdconfig-a-t vnode-f abc. iso-u 1
# Mount-t cd9660/dev/md1 MOUNT_DIR
# Umount MOUNT_DIR
7. tcsh and csh skills
In tcsh, you can use set autolist to set Automatic File Name and path filling.
In csh, you can set limit coredumpsize 0 to set the coredump size.
SET command line prompt
Set prompt = '% n @ % m % #'