NetAcad - NDG Linux Unhatched
NetAcad - NDG Linux Unhatched
NetAcad - NDG Linux Unhatched
The first field actually contains ten characters, where the first character indicates the type of
file and the next nine specify permissions. The file types are:
Symbo
l File Type Description
Permissions
Permissions indicate how certain users can access a file. Keep reading to learn more about
permissions.
Hard Link Count
This number indicates how many hard links point to this file. Hard links are beyond the scope
of this module, but are covered in the NDG Linux Essentials course.
User Owner
Group Owner
Directories and larger files may be shown in kilobytes since displaying their size in bytes
would present a very large number. Therefore, in the case of a directory, it might actually be
a multiple of the block size used for the file system. Block size is the size of a series of data
stored in the filesystem.
Timestamp
This indicates the time that the file's contents were last modified.
Filename
sudo command
The sudo command allows a user to execute a command as another user without creating a new
shell. Instead, to execute a command with administrative privileges, use it as an argument to
the sudo command. Like the su command, the sudo command assumes by default the root user
account should be used to execute commands.
sudo help
Permissions
Permission types
read (r) Allows for file contents to be read or Without execute permission on the directory, allows for a no
copied. execute permission, ls -l can provide a detailed listing.
write (w) Allows for contents to be modified or For this permission to work, the directory must also have ex
overwritten. Allows for files to be
added or removed from a directory.
execute (x) Allows for a file to be run as a process, Allows a user to change to the directory if parent directories
although script files require read well.
permission, as well.
To use the symbolic method of chmod first indicate which set of permissions is being changed:
o Others: Anyone other than the user owner or member of the group owner.
w write
x execute
./ hello.sh
This indicates the “command” should be run from the current directory.
In the following example, the file hello.sh ownership is changed from sysadmin to root. Once done, it can
only be executed with
Viewing files
cat [OPTIONS] [FILE] //cat =~ concatenate
The cat command displays all five lines of the file above. When viewing larger files,
the cat command can result in very lengthy output that cannot be paused to scroll through. A better
method of viewing long text files, is with a pager command which has a functionality that can pause
and scroll through the output of the file.