Return to Operationg Systems home
Produce the following tree of directories in your home directory:
osEx01
|
------------------------
| | |
src bin test
| |
---------- -----------
| | | |
include lib script results
src, then, using the directory src as the current directory, copy the file in the directories test, script, and results (to this extent use only absolute paths).more, less and cat to verify the content of the files.diff to verify that all the files have the same content.src, i.e., osEx01.
Executing all the commands from the root of your user (i.e., /home/username), do the following:
osEx01 into a directory tree named osEx01backup, by using the command cp to copy individual files and the command mkdir for directories.osEx01 by using the command rm to remove individual files and the command rmdir for directories“.cp and rm.Check what they do and for what the following commands are used:
pwdwchistory
For any problem, remember that you can use the following command to obtain an online help manual for a specific command:
man <command>Verify and reply to the following questions:
username and the group to which you belong./home directory (e.g., its subdirectories, etc.)home directory?
How is it possible to modify in the same way the access rights to all the files and directories of a directory tree (for example, to eliminate the read right to all, user, group, and other of the directory osEx01backup)?
lab01e03in.copylab01e03in.hllab01e03in.slls -ldiff command.lab01e03in.sl file have a different size than the others, but it has the same content?lab01e03in.txt with a text editor of your choicels -ldiff command.lab01e03in.txt in lab01e03in.backupls -l command?lab01e03in.backup with the content of the files lab01e03in.hl and lab01e03in.sl. Why in the second case do you obtain an error message?lab01e03in.txtlab01e03in.sl? Why?cat
Observation:
The command
touch <nomefile>
allows to update date and time of the last modification performed on a file.
In the case the specified file does not exist, it creates an empty file with that name.
Perform the following tasks using:
vim, emacs, gedit, etc.)gcc compiler (alternatively use an IDE of your choice, e.g., CodeBlocks).
Write a C language program that, using the ANSI C I/O primitives (fgetc/fputc, fscanf/fprint,fget/fputs of your choice), is able to copy a text file to an identical file.
The name of the two files is received on the command line, so that the program can be executed using a command that specifies three parameters:
nameExcutable sourceFile destinationFile
Compile the source files using gcc
sourceFile and destinationFile must be identic) using the shell command diff.How does the written program behave if you try to copy a binary file?
diff command.Change the program using
fread and fwrite functions (optional) and thenopen, read, write, and close POSIX system calls.diff command.install target, which allows tobinclean target, which removes the object file in the current directorydistclean target that calls the clean target and deletes the bin directory (which is the sibling of the current directory) and all its contentTake as reference the example analyzed in classroom: Makefile4