LL8 – More SysAdmin Commands

Introduction

As before, you are responsible for all previous Linux coursework and for researching the commands below in more depth using Wikipedia and the built-in Linux man pages.  You will also be taking screen shots, pasting them into your LastnameFirstnameLL8.odt file and submitting (uploading) them in BB.

SysAdmin Commands

quota

In a production environment, all users are allocated a certain amount of disk space on the file system for their personal files. There are several methods of managing this as you may not be allowed to exceed your quota or if you go over your quota, you may be given a predetermined amount of time to remove excess files. Now we are not running servers so we need to install quota so enter the following:

To check your quota on a production system enter:

$ quota -v 

Now we are not running a production system so we would first need to install quota and then set limits but we will not do this.

df

The df command reports on the space left on the file system (free disk space or disk free). For example, to find out how much space is left on the fileserver, type

$ df  #note you can also use df . to find out the space in your current directory

Exercise 8a

Execute a df, take a screenshot and paste it into your .odt file.  Also, along with the Exercise 8a heading in the .odt file, please list how much storage you provided the Virtual Box Ubuntu instance (e.g. the default 8 gb or more?).

Continuing on:

du

The du command outputs the number of kilobyes used by each subdirectory. Useful if you have gone over quota and you want to find out which directory has the most files. In your home-directory, type

$ du

Exercise 8b

Perform a du, pipe it through less, take a screenshot of the first less screenful and paste it into your .odt file labeling it appropriately.

Continuing on:

compress

This reduces the size of a file, thus freeing valuable disk space. Navigate to your ciss100/FirstnameLastname subdirectory and perform a long listing to note the size of your files.  Following this compress your lastnamefirstnameLL2.txt file.  I did this as follows:

$ compress loobyjamesLL.txt # note you may have to sudo apt-get install ncompress

This will compress the file and place it in a file called loobyjamesLL.txt.Z.  To see the change in size, perform another long listing.  Now recall there are 2 types of compression – lossy and lossless and this compression is lossless.  If you do not recall the difference between lossy and lossless compression and when they are used you need to read up on this as it is required.

Exercise 8c

Take a screenshot at this point and paste it into your .odt file labeling it appropriately.

Continuing on:

To uncomress the file, use the uncompress command as follows and you will need to do this to continue working with this file.

$ uncompress loobyjamesLL.txt.Z

gzip

This also compresses a file using lossless compression, and is more effective than compress. For example, to zip loobyjamesLL.txt, type

$ gzip loobyjamesLL.txt

This will zip the file and place it in a file called loobyjamesLL.txt.gz.

Exercise 8d

Compress the same file using gzip.  Perform another long listing to contrast the compressed file sizes (i.e. compress vs. gzip) take a screenshot and paste it into your .odt document.

Continuing on:

To unzip the file, use the gunzip command.

$ gunzip loobyjamesLL.txt.gz #please do this

file

file classifies the named files according to the type of data they contain, for example ascii (text), pictures, compressed data, etc.. To report on all files in your home directory, type

$ file *

history

The shell keeps an ordered list of all the commands that you have entered. Each command is given a number according to the order it was entered.

$ history #show command history list

You can use the exclamation character (!) to recall commands easily.

$ !! (recall last command)

$ !-3 (recall third most recent command)

$ !5 (recall 5th command in list)

$ !grep (recall last command starting with grep)

You can set the size of the history buffer

$ set history=100

Now for some reason the set history is not working in some Ubuntu 12.04 instances so if this is the case please try

$ HISTSIZE=100

Exercise 8e

Please take a screenshot, paste it into your .odt document and submit your assignment to BB as before.

Summary

  • quota
  • df
  • du 
  • compress & uncompress
  • gzip & gunzip
  • file
  • history
  • !

Leave a Reply