Keeping in mind the primary command in linux pwd, ls, mkdir, rmdir, mv touch, and cd also the wildcard: *, ?, [acf], [!a-f].

Also, it is important as administrators to know to manage soft links and hard links with [ln] command. The Soft link is the Type of links that point to other files instead of pointing to data on the hard drive. The soft link does not share the same inode number.

 Example:

Working with Links

touch actfile1
ls -il
stat acfile1
mkdir Linkdir 
cd Linkdir
ln ~/Activity3-7/actfile1 
cd ~/Activity3-7
ls -il
cd ~/Activity3-7
rm actfile1
ls -il
cd ~/Activity 3-7
rm actfile1 
ls -il
cd ~/Linkdir 
ls -il
cd ~/Activity3-7
ln -s ~/Linkdir/actfile1
ls -il
cd ~/Linkdir
ls -il

Creating a Shell Script

 #!/bin/bash
 # This is a comment line and can be
 # recognized by the preceding pound symbol.
 clear
 echo Your current directory is...
 pwd
 echo "You're changing to your parent directory, which is..."
 cd..
 pwd
 echo "You're moving back to the scripts directory."
 cd ~/scripts
 pwd
 echo "Here's a long listing of all your files anddirectories."
 ls -l

Apache Web Server

yast –-gtk

#clickingSoftwareon the left and then clicking Software Management.
#click the Filter list arrow, and then click Patterns. 
#click the Web and LAMP Server.
#After finishing then close the YaST Control Center.

#Testing an Apache Web Server
rcapache2 status
rcapache2 start
rcapache2 stop
yast –gtk

#Click Systemon the left, and then click System Services (Runlevel).
#Expert Mode
#Start/Stop/Refresh

#Test your Apache server by starting a Web browser and typing http://localhost in the address bar

Back-up

#Create, view, and extract tar archives
mkdir Act6-1
cd Act6-1
touch apple banana orange
tar -cvf fruit.tar apple banana orange 
ls -l 
rm apple banana orange 
ls -l
tar -tvf fruit.tar
tar -xvf fruit.tar 
ls -l
rm fruit.tar
mkdir Act6-2 
cd Act6-2
touch moon sun earth stars tree grass plant flower
tar -cvf space.tar moon sun earth
ls -l 
tar -tvf space.tar
tar -rvf space.tar stars 
tar -tvf space.tar 
vim sun 
#Type : We need the Sun
tar -uvf space.tar earth moon stars sun 
tar -cvf planet.tar tree grass plant flower 
tar -Avf planet.tar space.tar
tar –delete -vf planet.tar flower moon
tar -cvf new.tar moon flower tree
vim tree
#Type: trees give off oxygen
tar -dvf new.tar moon flower tree 

Incremental-backups

mkdir Act6-4
cd Act6-4 
touch math English history
tar -cv Wf $HOME/backup0.tar -V “This is a full backup of the Act6-4 directory” –listed-incremental=$HOME/act6-4.snap *
cd 
tar -tvf backup0.tar
cd Act6-4
tar -cvWf $HOME/backup1.tar -V “This is an incremental backup of the Act6-4 directory” –listed-incremental=$HOME/act5-4.snap *
tar -tvf backup1.tar
cd Act6-4 
rm *
tar -xvf $HOME/backup0.tar
tar -xvf $HOME/backup1.tar
ls -l

Creating a website

cd /srv/www/htdocs 
vim homepage.html
#Type  <html>
        <head>
         <title>First_Name Last_Name</title>
        </head>
        <body>
            This is my website
            <br>Click<a href=“index.html”>here</a> </br>
        </body>
       </html>
#Save and close.

vim index.html
#Type:

<html>
 <body>
  <h1>It works!</h1> <br>Click <a href="homepage.html">here</a> to go to your Web page!
 </body>
</html>

#Test your Web page by starting Firefox and entering localhostin the address bar.

For-Loop

#!/bin/bash
clear
for NUMBER in 10 9 8 7 6 5 4 3 2 1
do
echo "$NUMBER"
sleep 1
done
echo Blast off!

Menu Script

#!/bin/bash
clear
echo Please select a menu item
echo
echo "1) Display your current directory"
echo "2) Display your home directory"
echo "3) List the contents of your current directory"
echo
read CHOICE
if [ $CHOICE = 1 ]
then
pwd
fi
if [ $CHOICE = 2 ]
then
echo $HOME
fi
if [ $CHOICE = 3 ]
then
ls
fi
echo
echo Have a great day!

RPM Utility

#Go to http://download.opensuse.org/update/11.2/rpm/i586/, which lists i586 RPM packages.

su tiff-3.8.2-145.4.1.i586.rpm
cd /home/username/Download
ls -l 
rpm -ivh tiff-3.8.2-145.4.1.i586.rpm
rpm -q tiff
rpm -e tiff
rpm -Fvh
tiff-3.8.2-145.4.1.i586.rpm
rpm -Uvh tiff-3.8.2-145.4.1.i586.rpm
exit
rpm -ev gimp
rpm -ivh vlc-1.0.6-1.13.i586.rpm

Using condition Statements

#!/bin/bash
clear
echo "Enter the name of a file you think is in your currentdirectory."
read FILENAME5 if [ -a $FILENAME ]
then
echo "You're right. $FILENAME is in your current directory."
else
echo "Sorry. $FILENAME isn't in your current directory."
fi11 echo "Hope you enjoyed this script!"

Variables

#!/bin/bash
STARTLOCATION=$HOME
FILENAME=scr1
echo "Searching for the file named $FILENAME"
echo "in the $STARTLOCATION directory"
find $STARTLOCATION -name $FILENAME

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

Log in with your credentials

Forgot your details?