Page 194 - DCAP602_NETWORK_OPERATING_SYSTEMS_I
P. 194
Network Operating Systems-I
notes Give everyone (owner, group and others) read, write and execute permissions on file ‘file3’:
bash$ chmod a=rwx file3
user group others
Before: -irrelevant-
After: rwx rwx rwx
10.4 file search utilities
file management and manipulation
1. cp - copy files and directories
2. mv - move or rename files and directories
3. rm - remove files and directories
4. mkdir - create directories
These four commands are among the most frequently used Linux commands. They are the basic
commands for manipulating both files and directories.
Now, to be frank, some of the tasks performed by these commands are more easily done with a
graphical file manager. With a file manager, you can drag and drop a file from one directory to
another, cut and paste files, delete files, etc. So why use these old command line programs?
The answer is power and flexibility. While it is easy to perform simple file manipulations with
a graphical file manager, complicated tasks can be easier with the command line programs.
For example, how would you copy all the HTML files from one directory to another, but only
copy files that did not exist in the destination directory or were newer than the versions in the
destination directory? Pretty hard with with a file manager. Pretty easy with the command line:
$ cp -u *.html destination
Wildcards
Before we begin with our commands, let’s talk about a shell feature that makes these commands
so powerful. Since the shell uses filenames so much, it provides special characters to help you
rapidly specify groups of filenames. These special characters are called wildcards. The table
below lists the wildcards and what they select:
Summary of wildcards and their meanings.
wildcard meaning
* Matches any characters
? Matches any single character
[characters] Matches any character that is a member of the set characters. The set of characters can be
expressed as a range of characters. (For example, [A-Z] represents all uppercase letters)
[!characters] Matches any character that is not a member of the set characters
188 LoveLy professionaL university