В данном листе будут записываться на мой взгляд наиболее интересные и полезные команды в Линукс ОС. Команды привязанные к определённому типу дистрибутива будут помечены *. Cписок готовлю по большей части для себя, но думаю и вы можете найти чтото полезное.... Итак...
1. make bzimage modules modules_install install #kernel install
2. startx #start Xserver
3. dd if=dd.img of=/dev/fd0 #create image
4. fuser -mv /mnt/cdrom #kill user process
5. tar -xf /name.tar /file #extract archive
tar -cf /home.tar /home #arch directory
tar -czf /home.tgz /home #arch directory with zip compession
tar -cjf /home.tbz /home #arch directory with bzip2 compession
tar -t /home.tar # list of files in archive
tar -pcf /home.tar /home #save permisions
6. crontab -u [user] file.cron #insert task by user
at -f file 10pm Jul 12 #commands in file will exec in 22-00 12 Jul
7. split -b[number]k name.mp3 [name] #split file
cat name .* > name.mp3 #gather file
8. lstattr;chattr #list or change additional attributes
9. insmod;lsmod;rmmod;modinfo;modprobe #work whith modules
10. mkisofs -J -r -T -o /name.iso /mnt/cdrom #create image
cdrecord -v -eject speed=24 dev=0,0,0 /name.iso #burn image
11. chmod --reference=/file_A /file_B #copy rights
12. lokkit #iptables setup RH*
13. export LANG=en_US.UTF-8 #eng lang rh4.* in CLI
export LANG=ru_RU.UTF-8 #rus lang in CLI
export LANG=ru_RU.CP1251 #rus lang in CLI
14. rpm -ql [name] more #list of all packets
rpm -qc rpm.name #list of conf files of packet
rpm -qd rpm.name #list docs of packet
rpm -qf file.name #whose file
rpm -v rpm #check rpm before install
rpm -Uvh ftp://server1/pack_name #install by ftp
rpm -Uvh http://server1/pack_name #may NOT be install
rpm -i #install packet with save old
rpm -U #upgrade packet, remove old and install new
rpm -f #upgrade packet only if its already install
15. echo "text" | mail address@rcpt -s "head" #send e-mail
16. netstat -ntp #connections used programs
netstat -a #show all sockets
17. RAID create:
part raid.01 --size=600 --ondisk=sda
part raid.02 --size=600 --ondisk=sdb
part swap --size=128 --ondisk=sda
part swap --size=128 --ondisk=sdb
part raid.11 --size=1 --grow --ondisk=sda
part raid.12 --size=1 --grow --ondisk=sdb
raid / --level=1 --device=md0 raid.01. raid.02
raid /us --level=5 --device=md1 raid.11 raid.12
18. Network settings:
ifconfig eth0:1 192.168.0.1 mask 255.255.255.0 uproute add default gw 192.168.1.1
route add 0.0.0.0 gw 192.168.1.1
route add -net[-host] 172.20.0.0 netmask 255.255.0.0 gw 172.21.1.1
route add -net 10.0.0.0/8 gw 10.0.0.1
19. echo 1 > /proc/sys/net/ipv4/ip-forward #switch on forwarding
20. ethtool eth0 #link config
ethtool -s ethX autoneg off speed 1000 duplex full #ethernet settings
21. add in /boot/grub/grub.conf opposite kernel line:
vga=791 video=vesafb:mtrr,ywrap
22. Adding font to Xserver:
copy fonts to /usr/X11R6/lib/X11/fonts/TTF
edit /etc/X11/xorg.conf
restart Xserver
23. Check TLS/SSL connections:
$openssl
OpenSSL> s_client -host localhost -port 956
24. sendmail -d0 #debuging sendmail
25. TCPwrappers services names in /etc/services:
in.telnetd: 192.168.0.1
sshd, gdm: 192.168.0.2
vsftpd: 192.168.0.3, 192.168.0.4
portmap: www.redhat.com, example.com
$ldd `which sendmail` | grep libwrap #check TCPwrappers compatibility
26. iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128 #transparent proxyiptables -t nat -A POSTROUTING -s 192.168.0.0/24 -d 0/0 -o eth0 -j SNAT --to-source 212.23.98.45
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -d 0/0-j MASQUERADE #masquerading
27. /etc/security/* #limit many logging options
28. ether-wake -i eth1 -p 192.168.1.6 #wake up host
29. IGM:
/usr/local/stc/limit/* #logrotate and rotate scripts
squidguard update:
touch /var/lib/squidguard/mail/domain.diff
add +host.name in domains.diff
squidguard -u
30. $head -c8 /dev/random | uuencode -m - | sed -n '2s/=*$//;2p' #generate custom password31. find . -maxdepth 1 -type d -print | xargs du -sh | sort -rn #recurse view size of curent durectory
32. Find examples:find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
find . -uid 0 -exec chown 500 {} \;
find . -atime +365 | cpio -o > /mnt/backup/home-backup.cpio
find . -type f -mtime +7 -exec rm {} \;
find . -iname file.txt #insensitive find
find . -user [name] -group [name]
find . -perm 777 -exec chmod 644 {} \;
find . -size +1024000 -ok gzip {} \;
find . -ctime -3 -user chill -ok mv {}.org \;
find . -name "*.conf" -exec cp {} {}.org \;
find . -perm +o+w -exec chmod o-w {} \;
find . -atime[-amin,-anewer] #when file was last read
find . -mtime[-mmin,-mnewer] #when file data last changed
find . -ctime[-cmin,-cnewer] #when file metadata last changed
-10 less than 10 days ago
+10 more than 10 days ago33. iostat -x #disks status
34. /etc/default/useradd #users login correction
/etc/login.defs #specify password expiration for new accounts
35. arping -I eth0 10.0.0.2 #see another mac-address
36. sa-learn --spam --mbox /var/mail/spam #learn assassin to kill
37. tcpdump port 443 > file.log #logging tcp
38. mount.cifs //Win2003/share /mnt/mydir -o user=name%pass, rw #mount share from Windows
39. setfacl -m u:name:rw /home/name #ACL
40. chage -l [user] #users pass options info
41. :%s/test/tester/g #replace test by tester
42. pwconv #create shadow from /etc/passwd
43. ssh-keygen -t dsa -N ''
cat ~/.ssh/id_dsa.pub | ssh you@host-server "cat - >> ~/.ssh/authorized_keys2" #authorized by public key
44.nmap -sT -O localhost #see open services
45.$ftp localhost
>get some.file
quit
46. nice myprog
renice 15 -p PID #progs cpu prioritet
47. tzcelect #TIMEZONE select
48. ssh -X hostB[user@hostB]$ xterm & #remote Xterm
in /etc/ssh/sshd_conf
AllowUsers user
AllowGroups user
49. mkdir -p -m 0755 work/{inbox,outbox,sent}/{1,2,3} #recurcive create
50. SELinux :
getsebool -a
setsebool
getenforce -a
setenforce
51. KeyForRH5 :
645d-e430-65d6-1be4
33f2-ce52-3279-32ce
d6d9-4989-d752-b349
6e97-439c-6f1c-bb43
b13d-ad99-b0b6-53ad
52. cat /proc/scsi/qla2xxx/
scsi-qla0-adapter-port=2100001b320aaf95; #see WWN53. dd if=/dev/zero of=./sequre_disk bs=1024 count=50000 #crt file 50Mb
54. аутентификация - проверка подлинности пользователя
авторизация - проверки прав доступа пользователя к объектам системы
55.cat /dev/vcs1 #see another console
56.export DISPLAY=10.1.10.108:0.0 #export display
57. fcinfo hba-port #Solaris HBA info
58. Samba authentication types :
#In
#Attach log to syslogd
62.HTTP_PROXY="http://login:password@xxx.xxx.xx.xx:yyyy"
export HTTP_PROXY
#Proxy setting in system
63.Yum local repository:
cat /etc/yum.repos.d/local.repo
[localrepo]
name=local
baseurl=file:///media/localrepo/Server
enabled=1
gpgcheck=0
#createrepo /media/localrepo/Server
64.ssh -X user@hostB xterm &
65.MTU
#ip link set dev eth0 mtu 1350
# ip link list
66.watch -n 1 -d free
67.VM tools install on 5.7 :
69.
70.
1. make bzimage modules modules_install install #kernel install
2. startx #start Xserver
3. dd if=dd.img of=/dev/fd0 #create image
4. fuser -mv /mnt/cdrom #kill user process
5. tar -xf /name.tar /file #extract archive
tar -cf /home.tar /home #arch directory
tar -czf /home.tgz /home #arch directory with zip compession
tar -cjf /home.tbz /home #arch directory with bzip2 compession
tar -t /home.tar # list of files in archive
tar -pcf /home.tar /home #save permisions
6. crontab -u [user] file.cron #insert task by user
at -f file 10pm Jul 12 #commands in file will exec in 22-00 12 Jul
7. split -b[number]k name.mp3 [name] #split file
cat name .* > name.mp3 #gather file
8. lstattr;chattr #list or change additional attributes
9. insmod;lsmod;rmmod;modinfo;modprobe #work whith modules
10. mkisofs -J -r -T -o /name.iso /mnt/cdrom #create image
cdrecord -v -eject speed=24 dev=0,0,0 /name.iso #burn image
11. chmod --reference=/file_A /file_B #copy rights
12. lokkit #iptables setup RH*
13. export LANG=en_US.UTF-8 #eng lang rh4.* in CLI
export LANG=ru_RU.UTF-8 #rus lang in CLI
export LANG=ru_RU.CP1251 #rus lang in CLI
14. rpm -ql [name] more #list of all packets
rpm -qc rpm.name #list of conf files of packet
rpm -qd rpm.name #list docs of packet
rpm -qf file.name #whose file
rpm -v rpm #check rpm before install
rpm -Uvh ftp://server1/pack_name #install by ftp
rpm -Uvh http://server1/pack_name #may NOT be install
rpm -i #install packet with save old
rpm -U #upgrade packet, remove old and install new
rpm -f #upgrade packet only if its already install
15. echo "text" | mail address@rcpt -s "head" #send e-mail
16. netstat -ntp #connections used programs
netstat -a #show all sockets
17. RAID create:
part raid.01 --size=600 --ondisk=sda
part raid.02 --size=600 --ondisk=sdb
part swap --size=128 --ondisk=sda
part swap --size=128 --ondisk=sdb
part raid.11 --size=1 --grow --ondisk=sda
part raid.12 --size=1 --grow --ondisk=sdb
raid / --level=1 --device=md0 raid.01. raid.02
raid /us --level=5 --device=md1 raid.11 raid.12
18. Network settings:
ifconfig eth0:1 192.168.0.1 mask 255.255.255.0 uproute add default gw 192.168.1.1
route add 0.0.0.0 gw 192.168.1.1
route add -net[-host] 172.20.0.0 netmask 255.255.0.0 gw 172.21.1.1
route add -net 10.0.0.0/8 gw 10.0.0.1
19. echo 1 > /proc/sys/net/ipv4/ip-forward #switch on forwarding
20. ethtool eth0 #link config
ethtool -s ethX autoneg off speed 1000 duplex full #ethernet settings
21. add in /boot/grub/grub.conf opposite kernel line:
vga=791 video=vesafb:mtrr,ywrap
22. Adding font to Xserver:
copy fonts to /usr/X11R6/lib/X11/fonts/TTF
edit /etc/X11/xorg.conf
restart Xserver
23. Check TLS/SSL connections:
$openssl
OpenSSL> s_client -host localhost -port 956
24. sendmail -d0 #debuging sendmail
25. TCPwrappers services names in /etc/services:
in.telnetd: 192.168.0.1
sshd, gdm: 192.168.0.2
vsftpd: 192.168.0.3, 192.168.0.4
portmap: www.redhat.com, example.com
$ldd `which sendmail` | grep libwrap #check TCPwrappers compatibility
26. iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128 #transparent proxyiptables -t nat -A POSTROUTING -s 192.168.0.0/24 -d 0/0 -o eth0 -j SNAT --to-source 212.23.98.45
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -d 0/0-j MASQUERADE #masquerading
27. /etc/security/* #limit many logging options
28. ether-wake -i eth1 -p 192.168.1.6 #wake up host
29. IGM:
/usr/local/stc/limit/* #logrotate and rotate scripts
squidguard update:
touch /var/lib/squidguard/mail/domain.diff
add +host.name in domains.diff
squidguard -u
30. $head -c8 /dev/random | uuencode -m - | sed -n '2s/=*$//;2p' #generate custom password31. find . -maxdepth 1 -type d -print | xargs du -sh | sort -rn #recurse view size of curent durectory
find . -name '*.txt' -maxdepth 1 | xargs grep -l fedora | xargs wc -l
32. Find examples:find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
find . -uid 0 -exec chown 500 {} \;
find . -atime +365 | cpio -o > /mnt/backup/home-backup.cpio
find . -type f -mtime +7 -exec rm {} \;
find . -iname file.txt #insensitive find
find . -user [name] -group [name]
find . -perm 777 -exec chmod 644 {} \;
find . -size +1024000 -ok gzip {} \;
find . -ctime -3 -user chill -ok mv {}.org \;
find . -name "*.conf" -exec cp {} {}.org \;
find . -perm +o+w -exec chmod o-w {} \;
find . -atime[-amin,-anewer] #when file was last read
find . -mtime[-mmin,-mnewer] #when file data last changed
find . -ctime[-cmin,-cnewer] #when file metadata last changed
-10 less than 10 days ago
+10 more than 10 days ago33. iostat -x #disks status
34. /etc/default/useradd #users login correction
/etc/login.defs #specify password expiration for new accounts
35. arping -I eth0 10.0.0.2 #see another mac-address
36. sa-learn --spam --mbox /var/mail/spam #learn assassin to kill
37. tcpdump port 443 > file.log #logging tcp
38. mount.cifs //Win2003/share /mnt/mydir -o user=name%pass, rw #mount share from Windows
39. setfacl -m u:name:rw /home/name #ACL
40. chage -l [user] #users pass options info
41. :%s/test/tester/g #replace test by tester
42. pwconv #create shadow from /etc/passwd
43. ssh-keygen -t dsa -N ''
cat ~/.ssh/id_dsa.pub | ssh you@host-server "cat - >> ~/.ssh/authorized_keys2" #authorized by public key
44.nmap -sT -O localhost #see open services
45.$ftp localhost
>get some.file
quit
46. nice myprog
renice 15 -p PID #progs cpu prioritet
47. tzcelect #TIMEZONE select
48. ssh -X hostB[user@hostB]$ xterm & #remote Xterm
in /etc/ssh/sshd_conf
AllowUsers user
AllowGroups user
49. mkdir -p -m 0755 work/{inbox,outbox,sent}/{1,2,3} #recurcive create
50. SELinux :
getsebool -a
setsebool
getenforce -a
setenforce
51. KeyForRH5 :
645d-e430-65d6-1be4
33f2-ce52-3279-32ce
d6d9-4989-d752-b349
6e97-439c-6f1c-bb43
b13d-ad99-b0b6-53ad
52. cat /proc/scsi/qla2xxx/
scsi-qla0-adapter-port=2100001b320aaf95; #see WWN53. dd if=/dev/zero of=./sequre_disk bs=1024 count=50000 #crt file 50Mb
54. аутентификация - проверка подлинности пользователя
авторизация - проверки прав доступа пользователя к объектам системы
55.cat /dev/vcs1 #see another console
56.export DISPLAY=10.1.10.108:0.0 #export display
57. fcinfo hba-port #Solaris HBA info
58. Samba authentication types :
- Режим доступа пользователя (User-mode security): когда доступ к ресурсам Samba-сервера предоставляется в локальной рабочей группе по имени пользователя и паролю.
- Режим доступа ресурса (Share-mode security): когда доступ к каждому ресурсу на Samba-сервере осуществляется по паролю, присущему этому данному ресурсу, а не пользователям.
export HISTCONTROL=ignorespace
#DONT save commands start at "space"
60.
%_query_all_fmt %{n}-%{v}-%{r}.%{arch} #In
/etc/rpm/macros.prelink -for see arch.
61.
/usr/sbin/syslogd -ss -l /chroot/httpd/dev/log #Attach log to syslogd
62.HTTP_PROXY="http://login:password@xxx.xxx.xx.xx:yyyy"
export HTTP_PROXY
#Proxy setting in system
63.Yum local repository:
cat /etc/yum.repos.d/local.repo
[localrepo]
name=local
baseurl=file:///media/localrepo/Server
enabled=1
gpgcheck=0
#createrepo /media/localrepo/Server
64.ssh -X user@hostB xterm &
65.MTU
#ip link set dev eth0 mtu 1350
# ip link list
66.watch -n 1 -d free
67.VM tools install on 5.7 :
sed -i "s/\$content, \$image_file, \$kernRel/\$content,\
'--builtin=ehci-hcd --builtin=ohci-hcd --builtin=uhci-hcd', \
\$image_file, \$kernRel/g" \
vmware-config-tools.pl
68
1. dd if=/dev/sda bs=512 count=1 of=/dev/sdb
2. mkfs.ext3 /dev/sdb1
dd if=/dev/sda1 of=/dev/sdb1
3. fdisk /dev/sdb
d,2,d,3,n,p,2,_,_,w
4. mkfs.ext3 /dev/sdb2
dd if=/dev/sda3 of=/dev/sdb2
5. e2fsck -f /dev/sdb2
resize2fs /dev/sdb2
6. mkdir /b, mount /dev/sdb2 /b
vi /b/etc/fstab
reboot
69.
# echo "- - -" > /sys/class/scsi_host/host0/scan
# echo 1 > /sys/bus/scsi/devices/0\:0\:0\:1/rescan
# parted /dev/sdx
(parted) mklabel gpt
(parted) mkpart primary 0 8T
(parted) quit
# mkfs.ext3 /dev/sdxX
70.
LVM
# pvcreate /dec/sda3
# vgextend VolGroup00 /dev/sda3
# vgdisplay
# lvextend -l № /dev/VolGroup/LogVol00
# resize2fs /dev/VolGroup/LogVol00
71.
alicreate "DL380_7_22", "10:00:00:00:c9:91:83:53"
zonecreate "z_DL380_7_125_vnx1_spa1", "DL380_7_125; vnx1_spa1"
cfgadd "main", ""
cfgremove "main", ""
cfgsave
cfgenable main
cfgactvshow
Комментариев нет:
Отправить комментарий