http://www.f-notes.info:9102/linux:linux_command
Linux
arch
uname -m
uname -r
dmidecode -q
- (SMBIOS / DMI)
hdparm -i /dev/hda
cat /proc/cpuinfo
cat /proc/interrupts
cat /proc/meminfo
cat /proc/swaps
()
cat /proc/version
cat /proc/net/dev
cat /proc/mounts
lspci -tv
PCI
lsusb -tv
USB
date
cal 2007
- 2007-
date 041217002007.00
(.)
clock -w
BIOS
shutdown -h now
init 0
telinit 0
shutdown -h hours:minutes &
shutdown -c
shutdown -r now
reboot
logout
cd /home
'/home'
cd ..
cd ../..
cd
cd ~user
user
. 1 13
12.04.2012 13:05
Linux [...
http://www.f-notes.info:9102/linux:linux_command
cd -
pwd
ls
ls -F
ls -l
ls -a
ls *[0-9]*
tree
lstree
, (/)
mkdir dir1
'dir1'
mkdir -p /tmp/dir1/dir2
rm -f file1
'file1'
rmdir dir1
'dir1'
rm -rf dir1
'dir1'
mv dir1 new_dir
cp file1 file2
file1 file2
cp dir/* .
dir
cp -a /tmp/dir1 .
dir1
cp -a dir1 dir2
dir1 dir2
ln -s file1 lnk1
ln file1 lnk1
"" ()
, ,
(YYMMDDhhmm)
find / -name file1
file1. (/)
user1.
(/)
, '. bin'.
'/ home/user1'
'/usr/bin',
100
'/usr/bin',
10
, '.rpm',
, cdrom, floppy ..
locate "*.ps"
,
'updatedb'
. 2 13
'.ps'.
12.04.2012 13:05
Linux [...
http://www.f-notes.info:9102/linux:linux_command
whereis halt
, 'halt'
which halt
'halt'
mount /dev/hda2 /mnt/hda2
'hda2' '/mnt/hda2'.
- '/mnt/hda2'
umount /dev/hda2
'hda2'. , '/mnt/hda2'
. ,
-
umount -n /mnt/hda2
/etc/mtab.
" "
CD DVD
CD-R/CD-RW DVD-R/DVD-RW(+-)
ISO-
Windows FAT32
mount
-t
smbfs
username=user,password=pass
//winclient/share /mnt/share
mount
-o
/var/ftp/user
bind
-o
Windows (SMB/CIFS)
"" (binding).
/home/user/prg 2.4.0.
,
,
ftp ftp-
"" (chroot), .
df -h
, (..
-h *nix )
ls -lSr |more
du -sh dir1
,
(.. -h *nix )
'dir1'
rpm
-q
-a
--qf '%10{SIZE}t% ,
{NAME}n' | sort -k1,1n
rpm-, (fedora, redhat ..)
dpkg-query
-W
-f='${Installed- ,
Size;10}t${Package}n' | sort -k1,1n
deb-, (ubuntu, debian ..)
groupadd group_name
group_name
groupdel group_name
group_name
groupmod
-n
old_group_name
new_group_name
old_group_name new_group_name
user1,
useradd -c "Nome Cognome" -g admin
/home/user1, shell' /bin/bash,
-d /home/user1 -s /bin/bash user1
admin Nome Cognome
. 3 13
12.04.2012 13:05
Linux [...
http://www.f-notes.info:9102/linux:linux_command
useradd user1
user1
userdel -r user1
user1
passwd user1
user1 ( root)
user1
pwck
/etc/passwd /etc/shadow
grpck
/etc/group
. "-",
,
. ,
/etc/passwd
/
ls -lh
/tmp
directory1.
file1 user1
directory1
user1
- file1 group1
file1
, , SUID
SUID- /bin/binary_file.
.
SUID- /bin/binary_file.
SGID- /home/public.
SGID- /home/public.
STIKY- /home/public.
STIKY- /home/public
chattr +a file1
chattr +c file1
/ .
chattr +d file1
dump
backup'
. 4 13
12.04.2012 13:05
Linux [...
http://www.f-notes.info:9102/linux:linux_command
chattr +i file1
:
, , .
chattr +s file1
, ..
s , , ,
,
.
chattr +S file1
, , ,
, sync
chattr +u file1
lsattr
bunzip2 file1.bz2
gunzip file1.gz
gzip file1
bzip2 file1
'file1.gz'
'file1'
gzip -9 file1
file1
unrar x file1.rar
rar-
/tmp
bzip2(.. -j
*nix )
(.. -j
*nix )
gzip
zip-
zip-
/
unzip file1.zip
zip-
rpm -U package.rpm
,
,
rpm -F package.rpm
rpm -e package_name.rpm
. 5 13
12.04.2012 13:05
Linux [...
http://www.f-notes.info:9102/linux:linux_command
rpm -qa
, ,
"httpd"
rpm
-qg
Environment/Daemons"
"System
, /
.
.
, ,
rpm
--import /media/cdrom
/RPM-GPG-KEY
rpm --checksig package.rpm
rpm -V package_name
, , , , , MD5-
rpm -Va
--rebuild
yum update
yum list
rpm-,
rpm-,
. 6 13
12.04.2012 13:05
Linux [...
http://www.f-notes.info:9102/linux:linux_command
dpkg -i package.deb
dpkg -r package_name
dpkg -l
, ,
"httpd"
dpkg -s package_name
dpkg -L package_name
, ,
dpkg -S /bin/ping
, .
/ cdrom'
apt-get update
apt-get upgrade
apt-get check
apt-get clean
apt-get autoclean
cat file1
file1
tac file1
file1
( ..)
more file1
file1
less file1
file1
, (-),
..
head -2 file1
file1
. -
tail -2 file1
file1
. -
tail -f /var/log/messages
/var/log/messages
.
cat file | grep -i "Criteria" > result.txt
. ,
'/var/log/messages'
, "Aug"
. 7 13
12.04.2012 13:05
Linux [...
http://www.f-notes.info:9102/linux:linux_command
'/var/log/messages'
, "Aug"
'/var/log/messages'
,
,
"Aug", , /var/log
example.txt
example.txt
example.txt
sed -n '/string1/p'
"string1"
"string1"
cat -n file1
.
,
-,
/ /
. , -,
/ /
,
(, ,
)
,
'file1'
,
'file2'
dos2unix filedos.txt fileunix.txt
. 8 13
MSDOS UNIX (
)
12.04.2012 13:05
Linux [...
http://www.f-notes.info:9102/linux:linux_command
UNIX MSDOS (
)
page.html
recode -l | more
page.txt
html-
badblocks -v /dev/hda1
hda1 bad-
fsck /dev/hda1
/ linux-
hda1
fsck.ext2 /dev/hda1
/ ext2
hda1
e2fsck /dev/hda1
e2fsck -j /dev/hda1
/ ext3
hda1 ,
fsck.ext3 /dev/hda1
/ ext3
hda1
fsck.vfat /dev/hda1
fsck.msdos /dev/hda1
/ fat hda1
dosfsck /dev/hda1
mkfs /dev/hda1
linux- hda1
mke2fs /dev/hda1
ext2 hda1
mke2fs -j /dev/hda1
ext3 hda1
FAT32 hda1
fdformat -n /dev/fd0
mkswap /dev/hda3
swap- hda3
swap-
mkswap /dev/hda3
swap- hda3
swapon /dev/hda3
swap-, hda3
swap-, hda2
hdb3
(backup)
dump -0aj -f /tmp/home0.bak /home
/tmp/home0.bak
/home
/home
/tmp/home0.bak
/tmp/home0.bak
/tmp /home
. 9 13
12.04.2012 13:05
Linux [...
http://www.f-notes.info:9102/linux:linux_command
mkisofs -J -allow-leading-dots -R -V
"Label CD" -iso-level 4 -o ./cd.iso create an iso image of a directory
data_cd
cdrecord -v dev=/dev/cdrom cd.iso
cd-paranoia -B
cd-paranoia -- "-3"
cdrecord --scanbus
(LAN WiFi)
ifconfig eth0
eth0
ifup eth0
() eth0
ifdown eth0
() eth0
ifconfig eth0
255.255.255.0
192.168.1.1
netmask
eth0 ip-
promiscuous- eth0
dhclient eth0
eth0 dhcp-.
. 10 13
12.04.2012 13:05
Linux [...
route -n
http://www.f-notes.info:9102/linux:linux_command
netstat -rn
route add -net 0/0 gw IP_Gateway
echo
"1"
/ip_forward
(forwarding)
>
/proc/sys/net/ipv4
hostname
host 93.158.134.3
ip link show
mii-tool eth0
eth0
ethtool eth0
eth0 ,
netstat -tupn
TCP
UDP ip- PID' ,
netstat -tupln
TCP UDP
ip- PID' ,
TCP- 80 ( - HTTP)
iwlist scan
iwconfig eth1
eth1
.
nmblookup samba.
nbtscan ip_addr
nmblookup -A ip_addr
smbclient -L ip_addr/hostname
wget
smb-
mount
-t
smbfs
username=user,password=pass
//winclient/share /mnt/share
-o
windows-
smb-,
windows-
windows-,
IPTABLES (firewall)
iptables -t filter -nL
iptables -nL
iptables -t nat -L
iptables -t filter -F
iptables -F
NAT-
filter-
iptables -t nat -F
NAT-
iptables -t filter -X
filter-
. 11 13
12.04.2012 13:05
Linux [...
-p
tcp
http://www.f-notes.info:9102/linux:linux_command
telnet'
,
( )
ps -eafw
,
()
ps -e -o pid,args -- forest
PID'
pstree
kill -9 98989
kill -KILL 98989
PID 98989
kill -1 98989
kill -HUP 98989
PID 98989
lsof -p 98989
, PID 98989
lsof /home/user1
/home/user1
,
ls
last reboot
last user1
user1
lsmod
free -m
smartctl -A /dev/hda
/dev/hda SMART
smartctl -i /dev/hda
SMART /dev/hda
tail /var/log/dmesg
tail /var/log/messages
. 12 13
12.04.2012 13:05
Linux [...
http://www.f-notes.info:9102/linux:linux_command
apropos keyword
,
. , ,
man ping
, , - ping
whatis keyword
gpg file1.gpg
echo
'wget
www .example . com/files. iso'
09:00
-c
at
ldd /usr/bin/ssh
, ssh
alias hh='history'
hh history
. 13 13
12.04.2012 13:05