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
3 months ago Permalink
cluster icon
  • 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...
  • SED: Stream Editor for Text Manipulation : Basic Replace Syntax: sed -i 's/KENNY/LENNY/g' filename Substitute all occurrences of "KENNY" with "LENNY" Delete Line Containing String: s...
  • Bash : First Line of Script #!/bin/bash → defines the shell interpreter Comments Use # for commenting Common Elements Commands: echo, cp, etc. Statement...
  • Special Permissions (SetUID, SetGID, Sticky Bit) : chmod u+s xyz.sh → add SetUID (user-level special permission) chmod g+s xyz.sh → add SetGID (group-level special permission) chmod u-s xyz.sh → remov...
  • Linux filesystem : /boot -> Grub.cfg /root -> home of root /dev -> system device (mouse, keyboard) /etc -> configuration files /bin -> /usr/bin -> everyday user commands...


(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