command linux
File Commands: ls, cd, cp, mv, rm, mkdir, rmdir
text reading: cat, more, less
text tools: awk, grep, sed
text editors: vi, emacs, pico, gedit
time: date, cal, uptime
Location: find, locate, which, whereis
file extraction: tar, unzip, gunzip
Processes: top, ps, lsof, kill, fg, bg
User tools: passwd, w, who, finger, talk
environment: printenv, setenv, echo
Internet: lynx, pine, whois
Service control: chkconfig, init.d, service
Printing: lpr, lpq
Networking: ifconfig, route, traceroute, dig, ping
disk usage: du, df, quota
partitions: fdisk, fsck, mkfs, tune2fs, mount
Tell me something about my computer
uname -a
hostname
cat /proc/cpuinfo
lspci
cat /proc/pci
lsmod
Init allows you to control your system state
1 single user
2 multiuser
3 networking
4 reserved
5 X (aka the GUI)
6.reboot
Shutting down and Rebooting
/etc/shutdown -h now
/etc/poweroff
/etc/shutdown -t60 -r
/sbin/reboot
Output redirection
echo “this” > foo
echo “that” >> foo
cat foo
this
that
Pipes and More
The pipe |
cat /etc/passwd | grep
The semicolon ;
mkfs /dev/hdb1 ; mkfs /dev/hdb2
The slashdot ./
./myscript
Shell Scripting
A series of commands in an executable text file
—————————————————-
echo “Hello World”
echo “Print this to File” >> foo
lpr -Pmyprinter foo
————————————————–
It all starts with /
/bin
/boot
/dev
/etc
/home
/lib
/mnt
/opt
/proc
/root
/sbin
/tmp
/usr
/var
Partitions
/boot
/usr
/opt
/home
/var
/tmp
/
Files you never want to rm
*anything in /dev
*anything in /proc
*don’t get tempted by /proc/kcore
*anything in /boot
*/lib/kernel/modules/{the kernel you want to use}
*contents of /etc, /bin, /usr/bin, /usr/lib
*you may remove the contents of /tmp but not /tmp
lilo.conf example
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
message=/boot/message
password=huggybot
lba32
default=linux
image=/boot/vmlinuz-2.0.36
label=linux
root=/dev/hda2
read-only
other=/dev/hda1
label=win
Installing Packages
Debian Packages – dpkg
Red Hat Packages – rpm
rpm -Uvh package.rpm
rpm -ivh package.rpm
rpm -aq | grep package
rpm -e package
Tar files
To extract a tar.gz file: tar -zxvf {filename}
To extract a .tar file: tar -xvf foo.tar
To create a .tar file: tar -cvf /foodir foo.tar
once you’ve extracted the tar file look for a readme.
Perhaps there’s an executable installation file
Or a Makefile
Perhaps it’s source you need to compile yourself
File permissions
To check the permissions use “ls -l”
utilize groups
chown {username} {filename}
chown :{groupname} {filename}
chmod to change permissions
chmod a+rwx {filename}
chmod u+r {filename}
chmod o-x {filename}
chmod 700 {filename}
Filed under: Uncategorized | 2 Komentar
“:roll:”