Last updated: 20 Oct 2014
Overview of Linux and system administration; hands-on experience with basic administration tasks; testing results
2 hrs.
use of Unix/Linux
nothing
startup and shutdown scripts, in order
0 is stdin: <filename 1 is stdout: >filename (or >> to append) 2 is stderr: 2>filename (common: 2>&1 -- put same place as stdout)
See via:
> ls -l -rwxr--r-- 1 labadmin labadmin 267 Nov 6 2006 fix_perms
See via:
> df -h
simplicity vs. expandability
> fdisk /dev/sda
> mkfs -t ext4 /dev/sdb3 (for example)
fsck for large disks takes a long time. Using a journaled file system (e.g., ext3, ext4) is much quicker.
If you don't want to mount manually, put the mount info in the /etc/fstab and it will attach at startup or when requested.
device must not be in use, or it will fail. To see who is using a device, use fuser command
environment variables, standard file descriptors, memory map of code
This is the old style. New services are controlled by systemctl.
service ___ start/stop/restart/status
For example:
service network restart
systemctl start/stop/restart/status ____
For example:
systemctl start network
All X Window System based, allowing remote display of GUI (keyboard, mouse, display, window movement).
grep root /etc/passwd
Can also send backups over net.
Can also restore files from net.
might have to set EDITOR environment variable
requires onetime ("updatedb") or periodic process to update the database of files (/etc/cron.daily/mlocate.cron)
finds which command in the PATH
shows path
From command line:
useradd -d /home/ituser2 -m -G wheel -c "IT User 2" ituser2 passwd ituser2 id ituser2
Use the GUI.
groupadd demo usermod -a -G demo ituser2 id ituser2 usermod -a -G demo ituser3 id ituser3
Switch from GUI to console: Ctrl-Alt-F4
sudo bash
Note the difference between standard user and this. Try the same with ituser3 — what happened and what is the difference?
Tilde ("~") in a bash shell means use the current home directory.
tar zpscvf backup.tgz test
Look at contents of the archive:
tar ztvf backup.tgz
rm -ri ~/test
Note the danger of rm -rf.
cd /tmp tar zxvf ~/backup.tgz
Move restored files and directories to correct directory.
chmod o+r ~/test ls -ld ~/test
chgrp demo ~/test ls -ld ~/test
chmod u=rx,g-rwx,o-rwx ~/test/textfile
su ituser3 ls -l /home/ituser/test exit
crontab -e # add this line: 5 * * * * echo 5 minutes passed >/home/ituser/mylog # save the file
service sendmail stop
Very useful to look only at the end of it:
tail /var/log/messages
chkconfig sendmail off chkconfig --list sendmail
A document repository for everything linux
Clone the disk drives