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
Globally Disable VIM Auto-Indentation
cd /usr/share/vim/vim80
### DISABLE
cp -a indent.vim indent.vim.bak
echo "" > indent.vim
chattr +i indent.vim
### RESTORE
chattr -i indent.vim
rm -f indent.vim
mv indent.vim.bak indent.vim
When your bitter about someone else thinking they know what "everyone likes" and set your editor settings for you. Then fail to provide any documentation about how to reverse those settings...
sed -i '/^set ruler.*/ a\ \nautocmd FileType \* setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=t formatoptions-=q' /etc/vimrc
sed -i 's/filetype plugin on/filetype plugin off/' /etc/vimrc
echo "" >> /etc/vimrc
echo "autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=t formatoptions-=q" >> /etc/vimrc
echo "setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=t formatoptions-=q" >> /etc/vimrc
echo "set formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=t formatoptions-=q" >> /etc/vimrc
cp -a /usr/share/vim/vim80/indent.vim /usr/share/vim/vim80/indent.vim.bak
echo "" > /usr/share/vim/vim80/indent.vim
chattr +i /usr/share/vim/vim80/indent.vim
sed -i 's/filetype plugin indent on/filetype plugin off/' /usr/share/vim/vim80/defaults.vim
echo "" >> /usr/share/vim/vim80/defaults.vim
echo "autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=t formatoptions-=q" >> /usr/share/vim/vim80/defaults.vim
echo "setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=t formatoptions-=q" >> /usr/share/vim/vim80/defaults.vim
echo "set formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=t formatoptions-=q" >> /usr/share/vim/vim80/defaults.vim
This will grow...