3.5.
Summary
On UNIX, as on Linux, all entities are in some way or another
presented to the system as files with the appropriate file
properties. Use of (predefined) paths allows the users and the
system admin to find, read and manipulate files.
We've made our first steps toward becoming an expert: we
discussed the real and the fake structure of the file system, and
we know about the Linux file security model, as well as several
other security precautions that are taken on every system by
default.
The shell is the most important tool for interaction with the
system. We learned several shell commands in this chapter, which
are listed in the table below.
Table 3-10. New commands in chapter 3: Files and the file
system
Command |
Meaning |
bash |
GNU shell program. |
cat file(s) |
Send content of file(s) to
standard output. |
cd directory |
Enter directory. cd is a bash built-in command. |
chgrp
newgroup file(s) |
Change the group ownership of
file(s) to newgroup |
chmod
mode file(s) |
Change access permissions on
file(s) |
chown
newowner[:[newgroup]]
file(s) |
Change file owner and group
ownership. |
cp sourcefile targetfile |
Copy sourcefile to targetfile. |
df file |
Reports on used disk space on the
partition containing file. |
echo string |
Display a line of text |
export |
Part of bash that announces variables and their values to the
system. |
file filename |
Determine file type of filename. |
find path expression |
Find files in the file system
hierarchy |
grep PATTERN file |
Print lines in file containing the search pattern. |
head file |
Send the first part of file to standard output |
id |
Prints real and effective user
name and groups. |
info command |
Read documentation about command. |
less file |
View file with a powerful viewer. |
ln targetfile linkname |
Make a link with name linkname to targetfile. |
locate
searchstring |
Print all accessible files
matching the search pattern. |
ls file(s) |
Prints directory content. |
man command |
Format and display online (system)
manual pages for command. |
mkdir
newdir |
Make a new empty directory. |
mv oldfile newfile |
Rename or move oldfile. |
newgrp
groupname |
Log in to a new group. |
pwd |
Print the present or current
working directory. |
quota |
Show disk usage and limits. |
rm file |
Removes files and
directories. |
rmdir
file |
Removes directories. |
tail file |
Print the last part of file. |
umask
[value] |
Show or change new file creation
mode. |
wc file |
Counts lines, words and characters
in file. |
which
command |
Shows the full path to command. |
We also stressed the fact that you should READ THE MAN PAGES.
This documentation is your first-aid kit and contains the answers
to many questions. The above list contains the basic commands that
you will use on a daily basis, but they can do much more than the
tasks we've discussed here. Reading the documentation will give you
the control you need.
Last but not least, a handy overview of file permissions:
Table 3-11. File permissions
Who\What |
r(ead) |
w(rite) |
(e)x(ecute) |
u(ser) |
4 |
2 |
1 |
g(roup) |
4 |
2 |
1 |
o(ther) |
4 |
2 |
1 |