Linus Commands
Linus Commands
Q1
called dog.
b. Create another directory within that one called cat, and another within that called
mouse.
c. Remove all three directories. You can either remove them one at a time, or all at
once.
d. If you can delete directories with rm -r, what is the point of using rmdir for empty
directories?
The rm -r command can remove directories and their contents recursively, even if they are not
empty.
mdir is specifically use to remove empty directories only. So, the point of using rmdir for empty
directories is to ensure that you don't accidentally delete directories that contain files.
e. Try creating the dog/cat/mouse directory structure with a single command.
Q2
a. Copy the file /etc/passwd to your home directory, and then use cat to see what’s in it.
b. Rename it to users using the mv command.
c. Make a directory called programs and copy everything from /bin into it.
Q3
a. The touch command can be used to create new empty files. Try that now, picking a
name for the new
file:
$ touch baked-beans
b. Get details about the file using the ls command: $ ls -l
baked-beans
c. Wait for a minute, and then try the previous two steps again, and see what changes.
What happens when we don’t specify a time to touch?
Conclusion:
If you wait for a minute and then try the ls -l command again without re-executing the
touch command, you'll notice that the "baked-beans" file's last modification time (mtime)
will be updated to reflect the time when you last executed the ls -l command. This is
because the act of listing the file's details (ls -l) updates its access time (atime).
d. Try setting the timestamp on the file to a value in the future.