From 4d017c2d4dcb0276404340da972f4233e2553f9f Mon Sep 17 00:00:00 2001 From: bonnie Date: Sat, 15 Feb 2020 23:32:16 +0800 Subject: [PATCH] add "system" and "other" commands: - auditctl - df - identify --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index bc4b235..e12af62 100644 --- a/README.md +++ b/README.md @@ -1271,6 +1271,16 @@ xcowsay ## System [[back to top](#handy-bash-one-liners)] +##### Audit files to see who made changes to a file [RedHat based system only] +```bash +# To audit a directory recursively for changes (e.g. myproject) +auditctl -w /path/to/myproject/ -p wa + +# If you delete a file name "VIPfile", the deletion is recorded in /var/log/audit/audit.log +sudo grep VIPfile /var/log/audit/audit.log +#type=PATH msg=audit(1581417313.678:113): item=1 name="VIPfile" inode=300115 dev=ca:01 mode=0100664 ouid=1000 ogid=1000 rdev=00:00 nametype=DELETE cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 +``` + ##### Check out whether SELinux is enabled ```bash sestatus @@ -1631,6 +1641,11 @@ du -h du -sk /var/log/* |sort -rn |head -10 ``` +##### Show all file system type +```bash +df -TH +``` + ##### Show current runlevel ```bash runlevel @@ -1729,6 +1744,9 @@ group username ##### Show uid, gid, group of user ```bash id username + +# variable for UID +echo $UID ``` ##### Check if it's root @@ -2606,6 +2624,12 @@ while read a b; do yes $b |head -n $a ;done