Created
April 21, 2020 00:33
-
-
Save Zobber/38315a8f94845ff1aeaa7c4bae13daa3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check if Fail2Ban is Running | |
FAIL2BAN=`ps ax | grep fail2ban | grep -v grep | awk {'print $1'}` && if [ -n "$FAIL2BAN" ]; then printf "\n[INFO] Fail2Ban is running and the PID is %s\n\n" $FAIL2BAN; else printf "\n [INFO] Fail2Ban is not running\n\n"; fi | |
# alias to list hidden files of a folder | |
alias lh='ls -a | egrep "^\."' | |
# grep: find in files | |
egrep -in "this|that" *.dat | |
# Salty detailed directory listing... | |
ls -saltS [dirname] | |
# play all songs under current directory smoothly as background job | |
nice -n0 ls | mpg321 -@- & | |
# Cute, but we already had this figured out when the Linux kids were still slurp | |
ing down log-sized spliffs in the back of the microbus.ssh-keygen -R hostname | |
# Get My Public IP Address | |
lwp-dump http://www.boredomsoft.org/ip.php|grep Client | |
# Get colorful fortunes | |
cowsay `fortune` | toilet --metal -f term | |
# calculate the total size of files in specified directory (in Megabytes) | |
du -h <Directory> | |
# Recursive chmod all files and directories within the current directory | |
find . -name "*" -print0 | xargs -0 -I {} chmod 777 {} | |
# Read directory contents recursively | |
while read f;do echo "$f";done < <(find .) | |
# Get your external IP address | |
wget -O - -q ip.boa.nu | |
# Show the last movie/ebook that you have saw/read | |
ls -lAhutr | |
# Echo several blank lines | |
for i in `seq 1 100`;do echo;done | |
# byobu use | |
byobu | |
# Prefetch like apple devices | |
sudo apt-get install preload | |
# "Reset" file permissions | |
find . -type f -exec chmod 0644 {} \; | |
# Find different filetypes in current directory | |
find . -maxdepth 1 -type f -name '*.sh' -o -name '*.txt' | |
# Print only the odd lines of a file | |
awk '{if (NR % 2 == 1) print $0}' file.txt | |
# Equivalent of alias in cmd.exe: doskey (macros) | |
doskey l=dir /OD $* | |
# Check syntax of cron files (by restarting the service and checking the logs) | |
/etc/init.d/cron restart && tail -100 /var/log/syslog | |
# kill some pids without specific pid | |
kill -9 `ps aux | grep "search_criteria" | awk '{if ($2 != pid) print $2}'` | |
# Change password in list of xml files with for and sed | |
for i in `ls *xml`; do sed -e 's,oldpassword,newpassword,g' $i > $i.2 && mv -f $i.2 $i ; done | |
# See a list of ports running | |
netstat -an | grep -i listen | |
# Wordpress - download latest, extract, and rename config file. | |
alias wordpress='mkdir wordpress && cd wordpress && wget http://wordpress.org/latest.tar.gz && tar -xvzf latest.tar.gz && mv wordpress/* . && rm -rf latest.tar.gz wordpress && cp wp-config-sample.php wp-config.php' | |
# Get all IPs via ifconfig | |
ifconfig | grep "inet [[:alpha:]]\+" | cut -d: -f2 | cut -d' ' -f2 | |
# View facebook friend list [hidden or not hidden] | |
lynx -useragent=Opera -dump 'http://www.facebook.com/ajax/typeahead_friends.php?ninatodorovic&__a=1' |gawk -F'\"t\":\"' -v RS='\",' 'RT{print $NF}' |grep -v '\"n\":\"' |cut -d, -f2 | |
# empty a file | |
echo > filename | |
# Install NMAP 5.0, short and sweet command to do it | |
sudo wget -c "http://nmap.org/dist/nmap-5.00.tar.bz2" && bzip2 -cd nmap-5.00.tar.bz2 | tar xvf - && cd nmap-5.00 && ./configure && make && sudo make install | |
# cleaning after python | |
find ~ -name "*.pyc" -exec rm {} \; | |
# find the difference in 2 files with grep (diff alternative) | |
grep -vf file1 file2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment