Delete Set public Set private Add tags Delete tags
  Add tag   Cancel
  Delete tag   Cancel
  • • DevOps notes •
  •  
  • AI
  • Tags
  • Login
3 results tagged file

Linux File Ownership, ACLs, and I/O Redirects/shaare/e95DgQ

  • RHCSA
  • linux
  • file
  • ownership
  • acl
  • redirect
  • RHCSA
  • linux
  • file
  • ownership
  • acl
  • redirect

File Ownership

  • chown → Change ownership
  • chgrp → Change group

Access Control List (ACL)

  • setfacl → Set file ACL
  • getfacl → Get file ACL

Add Permission to User

setfacl -m u:user:rwx /path/to/file
setfacl -m g:group:rw /path/to/file

Recursive Inheritance from Folder

setfacl -R -m entry /path/to/dir

Remove Specific ACL Entry

setfacl -x u:user /path/to/file

Remove All ACL Entries

setfacl -b /path/to/file

Check ACL

ls -ltr

Example output:

-rw-rw-r--+

Help Commands

  • whatis command
  • command --help
  • man command

Add Text to a File

echo "my text" > myfile    # Overwrite
cat myfile                 # Read the text
echo "hello" >> myfile     # Append

Input and Output Redirects
3 Redirect Types

  • stdin → 0 → < or << → Feeding file content to a command
  • stdout → 1 → > or >>
  • stderr → 2 → 2> or 2>> → Write error output to a file

tee Command

  • tee → Output + Save
echo "test" | tee myfile
tee -a file  # Append
1 month ago Permalink
cluster icon
  • Navigating File System / Linux filetypes : ls -l → List pwd → Print working directory dr-xr-xr-x | directories -rw-r--r-- | file Linux File Types Symbol Type - Regular file d Dire...
  • Linux File Links and Permissions : Links Soft Link (Symbolic Link) ln -s Link will be removed if the original file is removed or renamed. Hard Link ln Deleting, renaming, or moving t...
  • Basic File Commands / File Search Commands : touch one two three → Create 3 files mkdir folder → Make directory mv -R / cp -R → Move or copy folder including subfolders find . -name "geor...
  • File Display Commands / Filters / Text Processing Input : File Display Commands cat → Show entire content cat -A → Show non-printable characters more → Paginate output less → Same as more but allows navigatio...
  • User management : Essential Commands: useradd, groupadd, userdel, groupdel, usermod Modify 3 files: /etc/passwd, /etc/group, /etc/shadow Create User with Custom O...

Linux File Links and Permissions/shaare/y0lAmg

  • RHCSA
  • red_hat
  • linux
  • file
  • permission
  • RHCSA
  • red_hat
  • linux
  • file
  • permission

Links

Soft Link (Symbolic Link)

  • ln -s
  • Link will be removed if the original file is removed or renamed.

Hard Link

  • ln
  • Deleting, renaming, or moving the original file will not affect the hard link.

Diagram

       INODE
        ↑
MY HARD LINK ← MYFILE.TXT → MY-SOFT-LINK

Command to check links:

ls -lTri

File Permissions

Permission Types

Symbol Permission Example (Mnemonic)
R Read Riri (4)
W Write Winnie (2)
X Execute Xena (1)

Each Permission (R, W, X) Can Be Controlled at Three Levels

  • U → User
  • G → Group
  • O → Others (Everyone)

Permission Strings

Example:

-rwxrwxrwx
 |   |  |
 |   |  └── Others
 |   └───── Group
 └───────── User

To remove write permission from all:

chmod a-w filename

To add read and write permission for user:

chmod u+rw filename

Directory Permissions

Example:

drwxrwxrwx
^   ^  ^
|   |  └── Others
|   └───── Group
└───────── User

Numeric Permission Mapping

Value Permissions Symbol Mnemonic
0 No permission ---
1 Execute --x Xena
2 Write -w- Winnie
3 Execute + Write -wx
4 Read r-- Riri
5 Read + Execute r-x
6 Read + Write rw-
7 Read + Write + Exec rwx

Example to set permissions:

chmod 764 file

Breakdown:

  • User (7) → rwx
  • Group (6) → rw-
  • Others (4) → r--
1 month ago Permalink
cluster icon
  • Linux filesystem : /boot -> Grub.cfg /root -> home of root /dev -> system device (mouse, keyboard) /etc -> configuration files /bin -> /usr/bin -> everyday user commands...
  • Linux File Ownership, ACLs, and I/O Redirects : File Ownership chown → Change ownership chgrp → Change group Access Control List (ACL) setfacl → Set file ACL getfacl → Get file ACL Add Permissi...
  • Navigating File System / Linux filetypes : ls -l → List pwd → Print working directory dr-xr-xr-x | directories -rw-r--r-- | file Linux File Types Symbol Type - Regular file d Dire...
  • Vi Editor : Vi Editor Commands i → insert mode I → insert at line start ESC → escape to command mode R → replace mode x → delete character dd → delete line yy → ...
  • Process monitoring : ps Command ps → Current shell process status ps -E → All running processes ps aux → All in BSD style with details ps -EF → Running process with detai...

Navigating File System / Linux filetypes/shaare/MUuvKg

  • RHCSA
  • linux
  • filesystem
  • file
  • RHCSA
  • linux
  • filesystem
  • file

  • ls -l → List
  • pwd → Print working directory

dr-xr-xr-x
|
directories


-rw-r--r--
|
file


Linux File Types

Symbol Type
- Regular file
d Directory
l Link
c Special file or device file
s Socket → Network communication / process data between external processes
p Named pipe → FIFO → First In First Out, data between internal processes
b Block device

Inode = Pointer or number of a file on a hard disk.

1 month ago Permalink
cluster icon
  • Basic File Commands / File Search Commands : touch one two three → Create 3 files mkdir folder → Make directory mv -R / cp -R → Move or copy folder including subfolders find . -name "geor...
  • Linux File Ownership, ACLs, and I/O Redirects : File Ownership chown → Change ownership chgrp → Change group Access Control List (ACL) setfacl → Set file ACL getfacl → Get file ACL Add Permissi...
  • Linux filesystem : /boot -> Grub.cfg /root -> home of root /dev -> system device (mouse, keyboard) /etc -> configuration files /bin -> /usr/bin -> everyday user commands...
  • Linux File Links and Permissions : Links Soft Link (Symbolic Link) ln -s Link will be removed if the original file is removed or renamed. Hard Link ln Deleting, renaming, or moving t...
  • File Display Commands / Filters / Text Processing Input : File Display Commands cat → Show entire content cat -A → Show non-printable characters more → Paginate output less → Same as more but allows navigatio...


(14)
Links per page
  • 20
  • 50
  • 100
Filter untagged links
Fold Fold all Expand Expand all Are you sure you want to delete this link? Are you sure you want to delete this tag? The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community