|
CS469 - Linux and Unix Administration and Networking
| Displaying exercises/e1/solution/e1.txt
1. Command to change your password?
passwd
2. Command to return to your home directory?
cd
cd ~
3. 'cp' commands to do the following:
a) Copy the file 'foo' as 'bar':
cp foo bar
b) Make a copy of the directory 'dir1' and _all its contents_ as 'dir2':
cp -r dir1 dir2
c) Copy all the files _in the current directory_ to the directory '~/.trash/':
cp -r . ~/.trash/
d) Copy a directory "foo" to "bar" preserving all the meta-information about
the files:
cp -a foo bar
4. How would you use "scp" to copy the directory "foo" to the home
directory of "user" on the machine "host.indstate.edu"?
scp -r foo user@host.indstate.edu:
5. How would you rename the file "foo" to "bar"?
mv foo bar
6. "ls" command to list ALL the contents of a directory in long format,
sorted in reverse by last modification time?
ls -a -l -r -t or ls -alrt
7. How would you use "mkdir", in a single invocation, to make the
sub-directory path "a/b/c" _in your home directory_?
mkdir -p ~/a/b/c
8. "chmod" commands to do the following (assume filename is 'foo'):
a) Make a file readable only by the owner and with no permissions for anyone
else:
chmod u=r,go= foo
chmod 400 foo
b) Make sure that a file is readable by everyone, but w/o modifying the other
permissions, whatever they may be:
chmod a+r foo
c) Make the file readable and writable by the user, readable by the group
and no permissions for other:
chmod u=rw,g=r,o= foo
chmod 640 foo
d) Make the file fully accessible by the user, no permissions for the group
and readable by other:
chmod u=rwx,g=,o=r foo
chmod 704 foo
|