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.
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.
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
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?).
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
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.
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.
Take a screenshot at this point and paste it into your .odt file labeling it appropriately.
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
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.
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.
To unzip the file, use the gunzip command.
$ gunzip loobyjamesLL.txt.gz #please do this
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 *
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
Please take a screenshot, paste it into your .odt document and submit your assignment to BB as before.
- compress & uncompress
- gzip & gunzip