Delete Set public Set private Add tags Delete tags
  Add tag   Cancel
  Delete tag   Cancel
  • • DevOps notes •
  •  
  • AI
  • Tags
  • Login

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

  • linux
  • linux

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
4 months ago Permalink
cluster icon
  • Alias Setup : alias l="ls -al" → define alias unalias l → remove alias Persistent Alias Config User-specific: ~/.bashrc Global: /etc/bashrc Add: alias l="ls -a...
  • Disk usage, logging, shutdown, hostname : Disk and Memory Info df → disk partition info df -h → human-readable format du → size of file/directory free → memory info cat /proc/cpuinfo → CPU in...
  • User management : Essential Commands: useradd, groupadd, userdel, groupdel, usermod Modify 3 files: /etc/passwd, /etc/group, /etc/shadow Create User with Custom O...
  • 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...
  • System information, root recovery, environment variables, shortcuts : Finding System Information cat /etc/redhat-release → Red Hat version uname -a → Linux hostname, kernel, architecture dmidecode → hardware, BIOS, syst...


(19)
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