cd /usr/ports/shells/bash
make install clean; rehash
Меянем шелл заданному юзеру:
chsh -s /usr/local/bin/bash testuser
Источник: http://www.cyberciti.biz/faq/howto-set-bash-as-your-default-shell/
cd /usr/ports/shells/bash
make install clean; rehash
chsh -s /usr/local/bin/bash testuser
sed '/nrg/d' '/etc/shadow'
mv folderpatch/* folder
mv: cannot move `test1' to `../test1': Directory not empty
mv: cannot move `test2' to `../test2': Directory not empty
mv: cannot move `test3' to `../test3': Directory not empty
cp -af folderpath/* folder
dd if=/dev/sdb3 of=/dev/zero bs=1M &
ps aux | grep dd
root 2 0.0 0.0 0 0 ? S< 09:54 0:00 [kthreadd] root 32228 17.0 0.0 5916 1624 pts/0 D 14:39 0:01 dd if /dev/sdb3 of /dev/zero bs 1M root 32239 0.0 0.0 4848 772 pts/0 S+ 14:39 0:00 grep dd
kill -USR1 32228
25289+0 записей считано
25288+0 записей написано
скопировано 26516389888 байт (27 GB), 417,757 c, 63,5 MB/c
cat file | perl -e 'for(<>){$a+=$_; $b++}; print $a/$b'
sort -g | tail -1Наименьшее
sort -g | head -1А вот со средним и суммой - сложности, тут в любом случае придется писать скрипт на каком-либо языке программирования. Либо... воспользоваться num-utils, которая предоставляет ряд чудесных утилит.
apt-get install -y num-utilsКак результат мы получим целый комплкект отменных утилит для работы с числами:
dpkg -L num-utils | grep '/usr/bin/'
/usr/bin/numaverage
/usr/bin/numbound
/usr/bin/numinterval
/usr/bin/numnormalize
/usr/bin/numgrep
/usr/bin/numprocess
/usr/bin/numsum
/usr/bin/numrandom
/usr/bin/numrange
/usr/bin/numround
cat | numsum
1
2
3
6
12
cat | numaverage
1
2
3
2
cat | numbound
1
4
6
1
444
5
444
4
1
0
1
3
444
0
chroot /mnt /bin/bash -c 'ls -la /dev'
total 8
drwxr-xr-x 2 root root 4096 Mar 25 12:13 .
drwxr-xr-x 21 root root 4096 May 19 15:59 ..
MAILCHECK Specifies how often (in seconds) bash checks for mail. The default is 60 seconds. When it is time to check for mail, the shell does so before displaying the primary prompt. If this variable is unset, or set to a value that is not a number greater than or equal to zero, the shell disables mail checking.
MAIL If this parameter is set to a file name and the MAILPATH variable is not set, bash informs the user of the arrival of mail in the specified file.
vi /etc/profile
# Disable You have new mail in /var/mail/root
unset MAIL
time sort -u /var/log/backup/2011-05-09.log > sort_standard
real 2m4.258s
user 2m3.716s
sys 0m0.344s
time LC_ALL=C sort -u /var/log/backup/2011-05-09.log > sort_fast
real 0m10.781s
user 0m8.965s
sys 0m0.548s
md5sum sort_fast
a1a339709059142d8700a2314481544b sort_fast
md5sum sort_standard
7a8ea0f6f1bdccc6fd0551b49aa3c99c sort_standard
wc -l sort_fast
295038 sort_fast
wc -l sort_standard
291784 sort_standard
ls -alh | grep sort
-rw-r--r-- 1 root root 30M 2011-05-09 02:55 sort_fast
-rw-r--r-- 1 root root 30M 2011-05-09 02:55 sort_standard
apt-[TAB]
apt-cache apt-config apt-ftparchive apt-key apt-sortpkgs
apt-cdrom apt-extracttemplates apt-get apt-mark
apt-get install -y bash-completion
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
test:~# apt-get up[TAB]
update upgrade
test:~# apt-get[TAB]
autoclean build-dep clean dselect-upgrade purge source upgrade
autoremove check dist-upgrade install remove update
vi /etc/profile
# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
pathmunge /usr/StorMan # добавленный путь
fi
# false | true
# echo $?
0
# set -o pipefail
# false | true
# echo $?
1
perl -pi -e 's/\r\n/\n/g' file.txt
bash: ./install.cgi: /usr/bin/perl^M: bad interpreter: No such file or directory
pid=`ps aux | grep nginx | grep worker | grep -v 'worker process is shutting down' | head -1 | awk '{print $2}'`
ps -eo pid,etime | grep $pid | awk '{print $2}'
26:05
echo -e "print\nnewline"
newline
-V, --version-sort natural sort of (version) numbers within text
git tag -l | grep '2.6.35'
Linaro-2.6.35-1000.2
Linaro-2.6.35-1000.3
Linaro-2.6.35-1001.5
Linaro-2.6.35-1002.6
Linaro-2.6.35-1003.7
Linaro-2.6.35-1004.8
Linaro-2.6.35-1004.9
Linaro-2.6.35-1005.10
Linaro-2.6.35-1006.11
Linaro-2.6.35-1006.12
Linaro-2.6.35-1007.13
Linaro-2.6.35-1008.14
Linaro-2.6.35-1008.15
Ubuntu-2.6.35-1.1
Ubuntu-2.6.35-10.15
Ubuntu-2.6.35-11.16
Ubuntu-2.6.35-12.17
Ubuntu-2.6.35-13.18
Ubuntu-2.6.35-14.19
Ubuntu-2.6.35-14.20
Ubuntu-2.6.35-15.21
Ubuntu-2.6.35-16.22
Ubuntu-2.6.35-17.23
Ubuntu-2.6.35-18.24
Ubuntu-2.6.35-19.25
Ubuntu-2.6.35-19.26
Ubuntu-2.6.35-19.27
Ubuntu-2.6.35-19.28
Ubuntu-2.6.35-2.2
Ubuntu-2.6.35-2.3
Ubuntu-2.6.35-20.29
Ubuntu-2.6.35-21.30
Ubuntu-2.6.35-21.31
Ubuntu-2.6.35-22.32
Ubuntu-2.6.35-22.33
Ubuntu-2.6.35-22.34
Ubuntu-2.6.35-22.35
Ubuntu-2.6.35-23.36
Ubuntu-2.6.35-23.37
Ubuntu-2.6.35-23.38
Ubuntu-2.6.35-23.39
Ubuntu-2.6.35-3.4
Ubuntu-2.6.35-4.5
Ubuntu-2.6.35-5.6
Ubuntu-2.6.35-6.7
Ubuntu-2.6.35-6.8
Ubuntu-2.6.35-6.9
Ubuntu-2.6.35-7.10
Ubuntu-2.6.35-7.11
Ubuntu-2.6.35-7.12
Ubuntu-2.6.35-8.13
Ubuntu-2.6.35-9.14
Ubuntu-2.6.35-903.10
Ubuntu-2.6.35-903.11
Ubuntu-2.6.35-903.12
Ubuntu-2.6.35-903.13
Ubuntu-2.6.35-903.14
Ubuntu-2.6.35-903.15
Ubuntu-2.6.35-903.16
Ubuntu-2.6.35-903.17
Ubuntu-2.6.35-903.18
Ubuntu-2.6.35-903.19
Ubuntu-2.6.35-903.8
Ubuntu-2.6.35-903.9
v2.6.35
git tag -l | grep '2.6.35' | sort -V
Linaro-2.6.35-1000.2
Linaro-2.6.35-1000.3
Linaro-2.6.35-1001.5
Linaro-2.6.35-1002.6
Linaro-2.6.35-1003.7
Linaro-2.6.35-1004.8
Linaro-2.6.35-1004.9
Linaro-2.6.35-1005.10
Linaro-2.6.35-1006.11
Linaro-2.6.35-1006.12
Linaro-2.6.35-1007.13
Linaro-2.6.35-1008.14
Linaro-2.6.35-1008.15
Ubuntu-2.6.35-1.1
Ubuntu-2.6.35-2.2
Ubuntu-2.6.35-2.3
Ubuntu-2.6.35-3.4
Ubuntu-2.6.35-4.5
Ubuntu-2.6.35-5.6
Ubuntu-2.6.35-6.7
Ubuntu-2.6.35-6.8
Ubuntu-2.6.35-6.9
Ubuntu-2.6.35-7.10
Ubuntu-2.6.35-7.11
Ubuntu-2.6.35-7.12
Ubuntu-2.6.35-8.13
Ubuntu-2.6.35-9.14
Ubuntu-2.6.35-10.15
Ubuntu-2.6.35-11.16
Ubuntu-2.6.35-12.17
Ubuntu-2.6.35-13.18
Ubuntu-2.6.35-14.19
Ubuntu-2.6.35-14.20
Ubuntu-2.6.35-15.21
Ubuntu-2.6.35-16.22
Ubuntu-2.6.35-17.23
Ubuntu-2.6.35-18.24
Ubuntu-2.6.35-19.25
Ubuntu-2.6.35-19.26
Ubuntu-2.6.35-19.27
Ubuntu-2.6.35-19.28
Ubuntu-2.6.35-20.29
Ubuntu-2.6.35-21.30
Ubuntu-2.6.35-21.31
Ubuntu-2.6.35-22.32
Ubuntu-2.6.35-22.33
Ubuntu-2.6.35-22.34
Ubuntu-2.6.35-22.35
Ubuntu-2.6.35-23.36
Ubuntu-2.6.35-23.37
Ubuntu-2.6.35-23.38
Ubuntu-2.6.35-23.39
Ubuntu-2.6.35-903.8
Ubuntu-2.6.35-903.9
Ubuntu-2.6.35-903.10
Ubuntu-2.6.35-903.11
Ubuntu-2.6.35-903.12
Ubuntu-2.6.35-903.13
Ubuntu-2.6.35-903.14
Ubuntu-2.6.35-903.15
Ubuntu-2.6.35-903.16
Ubuntu-2.6.35-903.17
Ubuntu-2.6.35-903.18
Ubuntu-2.6.35-903.19
v2.6.35