...
Expand | ||
---|---|---|
| ||
ls -l /stor/work/CBRS_unix/test (or ls -ld /stor/work/CBRS_unix/test/anna_only) shows the permissions of the anna_only directory are Because group permissions are So ls -l /stor/work/CBRS_unix/test/anna_only reports a Permission denied error. |
Basic file manipulation commands
The basic file manipulation commands are:
- touch to create a new, empty file or update the last modification date on an existing one
- mkdir to create a new directory
- cp to copy files (locally, within the current host computer)
- mv to move a file from one name to another (so rename the file)
- scp to securely copy files (to/from a remote computer)
Let's practice:
Code Block | ||
---|---|---|
| ||
cd # make sure you're in your Home directory
mkdir tmp # create a new directory called "tmp" and change into it
cd ./tmp # the "./" syntax is optional; means relative to current directory
touch f1.txt # create empty file called "f1.txt"
ls -l >> f1.txt # add some text by redirecting (appending) output from ls
mv f1.txt f2.txt # rename the "f1.txt" file to "f2.txt"
cp f2.txt f3.txt # copy "f2.txt" to a new file called "f3.txt" in this directory
mkdir dir2 # make a new "dir2" sub-directory
mv *.txt dir2/ # move the "f2.txt" and "f3.txt" to the "dir2" sub-directory
rm f*.txt # delete all f*.txt files in the current directory
cp dir2/*.txt . # copy all the *.txt files in the "dir2" directory to this directory
cp -r dir2/ dir3/ # copy the "dir2" directory and its contents to a new "dir3" directory
rm -rf dir2 # delete the "dir2" sub-directory |
See the Create, rename, linkto, delete files and Copying files and directories sections of the Some Linux commands page for more information.