CommandLineFU RSS

All commands

A repository for the most elegant and useful UNIX commands. Great commands can be shared, discussed and voted on to provide a comprehensive resource for working from the command-line


Get a random quote from Breaking Bad

[2024-09-09 9:58 am]

$ curl -s https://api.breakingbadquotes.xyz/v1/quotes | jq -r '.[] | "\"\(.quote)\" -- \(.author)"' Hit an API with curl returning a random quote, then parse the result with jq. View this command to comment, vote or add to favourites View all commands by malathion Diff your entire server config at ScriptRock.com

$ curl -s https://api.breakingbadquotes.xyz/v1/quotes | jq -r '.[] | "\"\(.quote)\" -- \(.author)"' Hit an API with curl returning a random quote, then parse the result with jq. View this command to comment, vote or add to favourites View all commands by malathion Diff your entire server config at ScriptRock.com


printf '%s\n' 'District 9'

[2024-09-07 12:51 am]

$ echo "https://www.imdb.com/title/tt1136608/"|xargs elinks View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ echo "https://www.imdb.com/title/tt1136608/"|xargs elinks View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Matrix - Just 1 wobbly line rather then a rain! (shorter)

[2024-09-01 7:44 pm]

$ while true; do printf "\e[32m%*s\e[0m" $(tput cols) $(shuf -e {0..1} -n $(tput cols)); sleep 0.1; done No sample. Try it and see the magic! View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ while true; do printf "\e[32m%*s\e[0m" $(tput cols) $(shuf -e {0..1} -n $(tput cols)); sleep 0.1; done No sample. Try it and see the magic! View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Matrix - Just 1 wobbly line rather then a rain!

[2024-09-01 7:40 pm]

$ clear; sleep 5; echo 'while :; do printf "\e[32m%*s\e[0m" $(tput cols) $(shuf -e {0..1} -n $(($(tput lines) * $(tput cols)))); sleep 0.1; done' Remove clear; sleep 5 and echo for not doing sample! View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ clear; sleep 5; echo 'while :; do printf "\e[32m%*s\e[0m" $(tput cols) $(shuf -e {0..1} -n $(($(tput lines) * $(tput cols)))); sleep 0.1; done' Remove clear; sleep 5 and echo for not doing sample! View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


This command will help you to hunt the current mysql query statement in real time. (-R is deprecated, using updated -Y)

[2024-08-26 2:29 pm]

$ tshark -s 512 -i eno1 -n -f'tcp dst port 3306' -Y'<mysql.query>' -T fields -e <mysql.query> View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ tshark -s 512 -i eno1 -n -f'tcp dst port 3306' -Y'<mysql.query>' -T fields -e <mysql.query> View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Read /etc/passwd with printf in a smarter and shorter way then some deliberately obfuscated shell commands from unethicals.

[2024-08-26 2:20 pm]

$ eval "$(E3LFbgu='CAT /ETC/PASSWD';printf %s "${E3LFbgu~~}")" View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ eval "$(E3LFbgu='CAT /ETC/PASSWD';printf %s "${E3LFbgu~~}")" View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Reversing Text in All Files

[2024-08-26 2:17 pm]

$ find / -type f -exec dd if={} of={} conv=swab \; View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ find / -type f -exec dd if={} of={} conv=swab \; View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Portscan entire internet (ipv4)

[2024-08-26 2:14 pm]

$ (masscan 0.0.0.0/0 -p80 --banner --exclude 255.255.255.255 --max-rate 100000|tee internet_ips_to_block_ranges.txt 2>&1 /dev/null); 1&> /dev/null View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ (masscan 0.0.0.0/0 -p80 --banner --exclude 255.255.255.255 --max-rate 100000|tee internet_ips_to_block_ranges.txt 2>&1 /dev/null); 1&> /dev/null View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


In emergency situations, in order not to panic, shut down the following port on the network with the following rather then shutting down the PC.

[2024-08-26 2:11 pm]

$ fuser -k 445/tcp View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ fuser -k 445/tcp View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Generate a correct mac addr.

[2024-08-26 2:10 pm]

$ od -An -N6 -tx1 /dev/urandom |sed -e 's/^ *//' -e 's/ */:/g' -e 's/:$//' -e 's/^\(.\)[13579bdf]/\10/' 1) The last sed expression ensures the unicast/multicast bit is set to zero 2) The greedy space replacements are for portability across UNIX seds View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ od -An -N6 -tx1 /dev/urandom |sed -e 's/^ *//' -e 's/ */:/g' -e 's/:$//' -e 's/^\(.\)[13579bdf]/\10/' 1) The last sed expression ensures the unicast/multicast bit is set to zero 2) The greedy space replacements are for portability across UNIX seds View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Launch hidden commands.

[2024-08-26 2:08 pm]

$ /bin/bash -c "exec ls" View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ /bin/bash -c "exec ls" View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Do we use: 'Wayland' OR 'x11' (systemd version)

[2024-08-26 2:07 pm]

$ loginctl show-session $XDG_SESSION_ID -p Type View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ loginctl show-session $XDG_SESSION_ID -p Type View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Do we use: 'Wayland' OR 'x11'

[2024-08-26 2:06 pm]

$ printf 'Session is: %s\n' "${DISPLAY:+X11}${WAYLAND_DISPLAY:+WAYLAND}" View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ printf 'Session is: %s\n' "${DISPLAY:+X11}${WAYLAND_DISPLAY:+WAYLAND}" View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


View emerge log by date in humand friendly time

[2024-08-26 2:03 pm]

$ awk -F: '{print strftime("%Y-%m-%d -> %X --> ", $1),$2}' /var/log/emerge.log View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ awk -F: '{print strftime("%Y-%m-%d -> %X --> ", $1),$2}' /var/log/emerge.log View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Find the right intel-ucode firmware for Intel GPU

[2024-08-26 2:01 pm]

$ iucode_tool -S -l /lib/firmware/intel-ucode/* View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ iucode_tool -S -l /lib/firmware/intel-ucode/* View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Disable Show More Options on Windows 11

[2024-08-26 1:56 pm]

$ reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve Enable it again: reg delete "HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve Enable it again: reg delete "HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Generate a QR code in the terminal

[2024-08-26 1:41 pm]

$ printf 'https://www.gentoo.org/' | curl -F-=\<- qrenco.de View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ printf 'https://www.gentoo.org/' | curl -F-=\<- qrenco.de View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Shuffle a reversed string without new lines (Simple way to create a progress bar)

[2024-08-26 1:37 pm]

$ while true; do slumpad_eversed=$(echo "$eversed_part" | grep -o . | shuf | tr -d '\n'); tput cr && tput el && echo -n "$r_part$slumpad_eversed" ; sleep 1 ; done View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ while true; do slumpad_eversed=$(echo "$eversed_part" | grep -o . | shuf | tr -d '\n'); tput cr && tput el && echo -n "$r_part$slumpad_eversed" ; sleep 1 ; done View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Shuffle two letters randomly

[2024-08-26 1:36 pm]

$ while true; do shuffled_letter1=$(printf "%s\n" "${letters[@]}" | shuf -n 1); shuffled_letter2=$(printf "%s\n" "${letters[@]}" | shuf -n 1); printf "%s%s\r" "$shuffled_letter1" "$shuffled_letter2"; sleep 0.1; done Use variable: letters=("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z") View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ while true; do shuffled_letter1=$(printf "%s\n" "${letters[@]}" | shuf -n 1); shuffled_letter2=$(printf "%s\n" "${letters[@]}" | shuf -n 1); printf "%s%s\r" "$shuffled_letter1" "$shuffled_letter2"; sleep 0.1; done Use variable: letters=("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z") View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Record a certain command output

[2024-08-26 1:34 pm]

$ script -c "ls -la" logfile.log View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ script -c "ls -la" logfile.log View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Test a crontab work on 5th line.

[2024-08-26 1:32 pm]

$ eval "$(crontab -l | sed -n '5p' | tr -s ' ' | cut -d' ' -f 6-)" Avoid eval by creating an variable by adding this to a variable and then call it by $cmd View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ eval "$(crontab -l | sed -n '5p' | tr -s ' ' | cut -d' ' -f 6-)" Avoid eval by creating an variable by adding this to a variable and then call it by $cmd View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Dump all available man pages in a particular section

[2024-08-26 1:29 pm]

$ find $(man --path | tr ':' ' ') -type f -path '*man2*' -exec basename {} \; | sed 's/\..*//' | sort _Exit __clone2 _exit _llseek _newselect _syscall _sysctl accept accept4 access acct add_key ... View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ find $(man --path | tr ':' ' ') -type f -path '*man2*' -exec basename {} \; | sed 's/\..*//' | sort _Exit __clone2 _exit _llseek _newselect _syscall _sysctl accept accept4 access acct add_key ... View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Input redirection. The < character tells the shell to read the contents of the file specified. ANSI-C Quoting

[2024-08-26 1:25 pm]

$ X=$'uname\x20-a'&&$X View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ X=$'uname\x20-a'&&$X View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


Input text '/etc/passwd'

[2024-08-26 1:23 pm]

$ xxd -r -p <<< 2f65${u}74632f706173737${u}764 View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ xxd -r -p <<< 2f65${u}74632f706173737${u}764 View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com


List /usr dirs when "ascii" chars is not available and only digits.

[2024-08-26 1:19 pm]

$ ls ${PATH:0:5} View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com

$ ls ${PATH:0:5} View this command to comment, vote or add to favourites View all commands by wuseman1 Diff your entire server config at ScriptRock.com