Quantcast
Channel: Commands by tyzbit
Browsing all 13 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Watch Video Files in the Terminal

$ cvlc /path/to/file.avi -V caca Use this command to watch video files on the terminal using VLC. prerequisite: VLC and cvlc sudo apt-get install vlc cvlc View this command to comment, vote or add to...

View Article



Image may be NSFW.
Clik here to view.

Wake up a remote computer

$ wakeonlan 00:00:DE:AD:BE:EF Wakes up a computer on your LAN with a Wake-On-LAN packet. MAC Address must match the NIC MAC, computer must have WOL enabled in the BIOS. View this command to comment,...

View Article

Image may be NSFW.
Clik here to view.

Monitor system load and print out top offending processes

$ while sleep 1; do if [ $(echo "$(cat /proc/loadavg | cut -d' ' -f1) > .8 " | bc) -gt 0 ]; then echo -e "\n\a"$(date)" \e[5m"$(cat /proc/loadavg)"\e[0m"; ps aux --sort=-%cpu|head -n 5; fi; done...

View Article

Image may be NSFW.
Clik here to view.

See crontabs for all users that have one

$ for USER in /var/spool/cron/*; do echo "--- crontab for $USER ---"; cat "$USER"; done This is not exhaustive but after checking /etc/cron* is a good way to see if there are any other jobs any users...

View Article

Image may be NSFW.
Clik here to view.

Watch who requests what page from apache logs

$ tail -f access_log | awk '{print $1 , $12}' Use this command to watch apache access logs in real time to see what pages are getting hit. View this command to comment, vote or add to favourites View...

View Article


Image may be NSFW.
Clik here to view.

Run a command that has been aliased without the alias

$ \[command] Most distributions alias cp to 'cp -i', which means when you attempt to copy into a directory that already contains the file, cp will prompt to overwrite. A great default to have, but when...

View Article

Image may be NSFW.
Clik here to view.

Read and write to TCP or UDP sockets with common bash tools

$ exec 5<>/dev/tcp/time.nist.gov/13; cat <&5 & cat >&5; exec 5>&- Ever needed to test firewalls but didn't have netcat, telnet or even FTP? Enter /dev/tcp, your new best...

View Article

Image may be NSFW.
Clik here to view.

Add Rudimentary Logging Levels According to STDOUT/STDERR

$ [command] 2> >(fb=$(dd bs=1 count=1 2>/dev/null | od -t o1 -A n); [ "$fb" ] && err=$(printf "\\${fb# }"; cat) && echo "ERROR - $err") This is a bit of a bash hack to catch...

View Article


Image may be NSFW.
Clik here to view.

Convert Kubernetes ConfigMaps to Secrets

$ cat configmap.json | jq 'with_entries(if .key == "data" then .value=(.value | to_entries | map( { (.key): (.value|@base64) } ) | add ) elif .key == "kind" then .value="Secret" else . end)' simple jq...

View Article


Image may be NSFW.
Clik here to view.

Check the total memory usage of processes with a specific name

$ pids=$(pidof chrome); for p in ${pids[@]}; do cat /proc/$p/status | grep -i vmrss | awk '{print $2}'; done | while read m; do let t=$t+$m; echo $t; done | echo "$(tail -n 1) kB" Get the total...

View Article

Image may be NSFW.
Clik here to view.

Uniquely (sort of) color text so you can see changes

$ function colorify() { n=$(bc <<< "$(echo ${1}|od -An -vtu1 -w100000000|tr -d ' ') % 7"); echo -e "\e[3${n}m${1}\e[0m"; } Colorify colors input by converting the text to a number and then...

View Article

Image may be NSFW.
Clik here to view.

Tail a log and replace according to a sed pattern

$ tail -F logfile|while read l; do sed 's/find/replace/g' <<< $l; done Tails a log and replaces it line-by-line according to whatever you want to replace. Useful if the file writing to the log...

View Article

Image may be NSFW.
Clik here to view.

Color STDERR in output

$ ./errorscript.sh 2> >(echo "\e[0;41m$(cat)\e[0m") This command will take the output of a command and color any STDERR output as a different color (red outline in this case) View this command to...

View Article

Browsing all 13 articles
Browse latest View live




Latest Images