There’s a lot more to dealing with files on Linux than developing, listing and updating them. After all, files can be Linux commands (i.e., binaries), scripts, images, simple text files, guidelines to other files or folders. You might keep in mind the “everything is a file” description of Unix and Linux systems.Even sockets and called pipelines are files in their own way. Often just the owner can see and utilize files, often everyone can and sometimes choose individuals will also have access. Here are a few of the subtleties.Listing files Listing files on Linux is easy. You utilize the ls command. On
the other hand,
commands like ls, ls -l, ls -a and ls -ltr work very in a different way: The ls command with no arguments simply lists file names The ls
- -l( long listing) command adds file consents
- The ls -a command includes file names that
- start with dots(often referred to as “surprise files”)The ls-ltr command shows files in old-to-new order while ls -lt lists the files in new-to-old order Developing and updating files If you wish to develop an empty
file or upgrade the timestamp on
a file, use the touch command. Using touch -a will just alter the gain access to time. Using touch -d followed by a date (e.g., touch -d 20230101) will update the timestamp to the date defined:$ls -l message- rw-rw-r–. 1 shs 39 Jun 12 2019 message $touch-d 20230101 message$ ls- l message -rw-rw-r–. 1 shs 39 Jan 1 00:00 message The permissions string displayed for any file can
be broken down as follows: The first character represents the file type Characters 2-4 reveal the owner’s authorizations Characters 5-7 show the group’s permissions Characters 8-10 show the consents
=== ======= ===== ====== ==== ======== == ===- rwx r– r– +1 shs 39 Jan 1 00:00 message-rw- r– r–. 1 shs 425 Sep 19 11:42 5letters d rwx r-x. 4 shs 4096 Nov 19 14:46 bin l rwx rwx. 1 shs 13 Mar 23 2020 www->/ var/www/html The file type will usually be shown as a hypen(-)indicating it’s a routine file, however this doesn’t differentiate a text file from an image, and so on. A”d
“implies it’s a directory and an”l” indicates that it’s a symbolic link. In reality, if you utilize a command like this one, you can count how many of each file type you have in the current directory.$ ls- l|cut – c-1|sort|grep- v t|uniq-c 970- 88 d 17 l I placed the grep-v t command so as not to consist of the final” total”(the file count )that is added by the sort command. Altering file consents
and ownership You can utilize the chmod(modification file owner )command to change file consents. The command enables you to change