find all files with suid or sgid on the system

find all files with set user id or set group id on the server

find / \( -perm -004000 -o -perm -002000 \) -type f -print

find all files on the system modified the last 90 minutes

find / -type f -mmin -90

find all files in home modified the last 90 minutes

find ~ -type f -mmin -90

one line webserver

:;while [ $? -eq 0 ];do nc -vlp 8080 -c’(r=read;e=echo;$r a b c;z=$r;while [ ${#z} -gt 2 ];do $r z;done;f=`$e $b|sed ’s/[^a-z0-9_.-]//gi’`;h=”HTTP/1.0″;o=”$h 200 OK\r\n”;c=”Content”;if [ -z $f ];then($e $o;ls|(while $r n;do if [ -f "$n" ]; then $e “`ls -gh $n`”;fi;done););elif [ -f $f ];then $e “$o$c-Type: `file -ib $f`\n$c-Length: `stat -c%s $f`”;$e;cat $f;else $e -e “$h 404 Not Found\n\n404\n”;fi)’;done

run dpkg-query on all contents of bin

ls /bin/* | xargs -t -I{} dpkg-query -S {}

copy a directory from a remote host to a local archive

ssh [username@]<hostname | ip adres> "tar czvf - [path/directory]" > archive.tar.gz

example:

ssh user@host.com “tar czvf - /home” > home.tar.gz

transfer directory recursively over ssh

transfer directory to remote host

tar czvf - [directory]| ssh <hostname | ip adres > tar xzvf -

example:

tar czvf - /home | ssh 192.168.34.35 tar xzvf -

tar over ssh

make a remote archive of a local directory, well known, very useful command. If you need to backup something but have no (not enough) local space left.
tar command for creating archive z is for gzip v is for verbose c is for create and f is for file.

tar czvf - <directory> | ssh [username@]<hostname | ip adres> "cat > <archivename>.tar.gz"

so to archive foobar's home directory to remote host at 127.0.199.166 and put the archive in directory backups and name it foobarshome.tar.gz

tar czvf - /home/foobar | ssh root@127.0.199.166 "cat > foobarshome.tar.gz"

using a hostname

change extensions for all files with a specific extension

rename all files in current directory with the extension bar to equal filenames with the extension foo

for f in *.bar; do mv $f $f.foo; done

copy all files with one extension to files with another extension

copy all files in current directory with the extension bar to equal filenames with the extension foo

for f in *.bar; do cp $f $f.foo; done