usermod-a-G<group><user>usermod-g<group><user>#transfer user to groupusermod-a-Groot<user>#add to rootusermod-a-Grdp<user>#add to rdp enabled groupusermod-a-Gftp<user>#add to ftp enabled group
find.-typef-name"<name>"2>/dev/nullfind.-typef-name"*.conf"2>/dev/nullfind.-typef-name"*.txt"2>/dev/nullfind.-typef-mtime+<days>2>/dev/null#files older than x daysfind.-typef-name"<name>"-execcat{} \; 2>/dev/null#find and print filels-hls-lah
Mounting
mount / unmount
mount#list currently mounted resourcesmount-t<type><ip>:/<sharepath><pathtomountpoint>umount<pathtomountpoint>umount-f<path>
Resolve "file is busy" unmount error
fuser<pathtomountpoint>#list all processes accessing the mount pointfuser-k<pathtomount>#kill all processes accessing the mount point
Permissions
Permission types
Check permissions
ls -alh <file>
Alter permissions
chmod +<repr> <file> #add permission
chmod -<repr> <file> #drop permission
chmod <decimal for user,group,others i.e. 760> <file> #set all for users, r+w for owner group, none for others
chown <user> <file> #change file owner
chown <user>:<group> <file> #change file owner specifying user's group
Archives
Tar
--Add to archive--
tar -cf <archive>.tar <file1 file2... or dir/>
tar -uvf <archive>.tar <file to add>
--List files--
tar -tvf <archive>.tar
--Compress--
tar -czvf archive.tar.gz <dir>/
--Extract--
tar -xvf <archive>.tar -C <path to extract>
tar -xzvf <archive>.tar.gz -C <path to extract>
Zip
--Archive--
7z a -t<type> <archive>.<type> <dir>
7z a -mhe=on -p<password> <archive>.7z <dir>
--Extract--
7z e <archive>.<type> -o <dir output>
--Extract full paths--
7z x <archive>.<7z,zip,gzip,bzip2,tar> -o <dir output>
gunzip <archive>.zip > <filename>.txt
Text
Extract
Between two delimiters (from pipe or specify filename)
su -c '<command>' <user>
su - <user> -c '<command>' #may ask for password
sudo -u <user> <cmd> #simulate user login
find -type f -name "*.txt" -exec cat "{}" \;
find -type f -name "*.txt" -exec mv "{}" <dst> \; #useful when mv throws errors
find -exec mv "{}" <dst> \; #move all files and folders from here
ls | wc -l #count files in folder
wc -l <file> #count the lines in file
wc -w <file> #count the words in file