User Tools

Site Tools


notes:unix:fall2023:projects:dac0

DAC0 project documentation

Toolbox

It would be especially useful to review the manual pages or any documentation on the following resources:

  • ls(1) - lists files.
  • ls -l(1) - allows you to see additional information on all of your current directory's contents.
  • zip(1) - compresses files into a smaller form.
  • rev(1) - allows you to reverse the text in a txt.file.
  • tac(1) - allows you to flip the text around vertically, so that the bottom text will become the top text and the top text will become the bottom text.
  • uuencode(1) - allows you to archive files and directories.
  • file(1) - allows you to see what kind of file a file is and if anything special needs to be done to it.
  • stat -c %s(1) - allows you to see the byte size of a file.
  • tar -xf archive.tar[.gz/bz2](1) allows you to extract tar, Tar Gz, and Tar Bz2 Archives.
  • rm -rf directoryname(1) allows you to remove a directory as well as the files in the directory and subdirectories.

Background

What is an archive

An archive is where you take multiple files and place them all in the same file. The new archive file would be the same size as if you added all of the sizes from the different files together.If you were to put 7, 10 mb into an archive, the archive would be the size of 50 mb. Tar is a command which does both archiving and a bit of compression.

What actions can be performed on an archive?

On an archive you can view the contents, append the contents, extract some of the contents, or 'unpack' all of the contents.

What is compression

Compression is a technique used to reduce file size.

How does compression differ from archiving?

Short answer: Archiving stores multiple files in one file without changing the size the files take up, compression changes the bit pattern to reduce the size of the file or files.

Types of compression (lossy vs lossless)

The two types of compression are referred to as lossy and lossless. Lossy causes data to be lost during the compression process, while lossless techniques of compression allow original data to be reconstructed perfectly from the compressed data when the file is extracted.Hence the names lossy and lossless.

Procedure

In the UNIX class Public Directory on lab46 you will find a dac0/ subdirectory. You can reach the directory by cd /var/public/fall2023/unix/. Once there use ls to check see if you can find it. Once there enter the dac0 directory and into your the directory with your username. From there you can cp the files, specifying the absolute path to your dac0 (assuming you already made a dac0 directory in where you store your projects) directory in your home directory like ~/src/fall2023/unix/dac0/. Then head to that directory via the same absolute path that you specified and verify all of the files are there with ls.

Next unzip each of the files using tar “-cf file.tar” and “unzip file.zip”

Check each of the text files, some are in English and others you will have to reverse, flip, or decode using the commands in the toolbox above.

Once this is done use the stat “-c %s filename” command to see how big each file is, then rename them in order from smallest to largest with the letters of the alphabet, a being smallest, h being the largest.

Repository Operations

Checking current repository status

You can check the current repository status by using “hg status”

Adding untracked files to repository

You can add untracked files to your repository by using the “hg add -I -a” command. -I for include pattern -a for “All untracked”

Committing changes

To commit a file, you must use hg commit [file1, file2,…] command with the files that you already added. It will take you to a screen similar to nano or pico editors. Once there you can type a name for your commit and then press enter to accept the name. It will ask if you are sure that you want to save it to a confusing looking name. Press enter and it will return you to the command line. Use hg status to see if you can see any files that you just tried to commit. If you don't see them than your commit will have been successful.

Pushing commits upstream to server

To get your commit actually committed you should use “hg push” to push the file along to be pulled at a later time.

Pulling changes from server

You can pull changes from the server by using the “Hg pull” command.

Updating current repository

hg update to update your system after everything has been pulled

notes/unix/fall2023/projects/dac0.txt · Last modified: 2023/09/05 23:59 by jbernata