uname -a
lscpu or cat /proc/cpuinfo
lspci
see here for more https://wiki.archlinux.org/index.php/Keyboard_Shortcuts
Ctrl+t Ctrl+r
Ctrl+X then Ctrl+E
command ESC. command !$ command !*
Ctrl+w Ctrl+u Ctrl+k Esc+d Alt+d Alt+Ctrl+y Paste the first argument of the previous command Alt+. or Alt+_
cd - >>> move back to last dir
^wrong_command^command
#!/bin/bash
useradd -m $1
passwd $1
mkdir -p /shared/$1
chown $1:users /shared/$1
chmod 755 /shared/$1
ln -s /shared/$1 /home/$1/shared
chown /home/$1/shared
#!/bin/bash
ip = `route -n | grep UG | tr -s " " | cut -f 2 -d " " `
ping = "/bin/ping"
echo "testing gateway @ $ip by pinging 5 times"
ping -c 5 $ip
#!/bin/bash
echo -n "Enter user name:"
read name
useradd -m $name
passwd $name
.....
#!/bin/bash
if [-s /var/apache2/log]
then
tail /var/apache2/log
exit
fi
OR
if test -s /var/apache2/log
then
tail /var/apache2/log
exit
fi
#!/bin/bash
for d in `ls *.wav`; do
aplay $d
done
#!/bin/bash
doit(){
cp $1 $2
}
function check(){
if [ -s $2]
then echo "target file exists"
exit
fi
}
check $1 $2
doit $1 $2
FILES
touch -d "April 13 xxx" file.txt
touch -t 20140215hhmm file.txt
ln -s origname linkname
mkdir
rmdir
rmdir -p parentdir/childdir >>>>> remove both dirs
HELP
whatis
man
/pattern >>>> search forward
?pattern >>>> search backward
n or / repeat search
info
PROGRAM & PROCESS
yum /apt-get
apt-get [install/update/upgrade/remove/purge]
ps u
ps ax | less
ps aux
top
top -M
free
ll /var/log
dmesg | less
SEARCHING >
>>
2>
2>>
&> create new file containing both standard and error output
<
<<
<> both ways
xargs [options] [command [initial-args] ]
Example:
find ./ -name "*~" | xargs rm
rm `find ./ -name "*~"`
EXTRACTING/ARCHIVING
tar cvfz target_file.tgz ~/source_file
tar xvfz file.tgz
who
w
getent passwd
cat /etc/passwd
cat /etc/shadow
cat /etc/group
chgrp
chown
chmod
sticky bit + special permission
ifconfig
ifconfig eth0 up [ip] netmak 255.255.255.0\
host
route
route add defaut gw [gateway ip]
traceroute
ll /etc/network/interfaces
cat /etc/resolv.conf
netstat -i
netstat -a