One Liners And Things
I guess, moving forward I should start putting all my quick commands I find into a collection. Rather then thinking I can remember them. That thinking fails me more often than not, and I find myself searching the world again for that one thing that worked.
This will be my avenue for self preservation.
Remove SELINUX context from all files (the dot):
find / -exec setfattr -h -x security.selinux {} \;
Move the last 1000 files to a different location:
ls -a1 | tail -n1000 | xargs -i mv {} ./location
Count the number of files in a directory:
ls | wc -l
AWK out some characters:
little test script...
cat > test.sh << "EOF"
#!/bin/bash
DSK=$(findmnt -n -o SOURCE /boot | awk '{ print substr($0,1,8) }')
printf "\n${DSK}\n\n"
EOF
The print substr is looking at (string, start, count).
$0 (provided string), 1 (starting point in the string), 8 (how many more to display after the starting point)
This will grow...