Nice bash shell prompt examples.

This is a very simple, but nice shell prompt. PS1="\[\033[38;5;49m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;43m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;39m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]:\$?:\\$\[$(tput sgr0)\]"PS1="\[\033[38;5;49m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;43m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;39m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]:\$?:\\$\[$(tput sgr0)\]" This is what it looks like. /home/robert/Desktop:mycomputer@mario:0:$/home/robert/Desktop:mycomputer@mario:0:$ Another nice bash shell prompt. PS1="-\t– \u@\h [\w]\$ "PS1="-\t– \u@\h [\w]\$ " It looks like this. Not as good, but simpler than the above example. -12:01:11– … Read more

Miscellaneous Linux commands. Some useful tips for the Linux BASH prompt.

The ldd command will print out a list of all libraries that an executable is linked against. This is the output for a simple “Hello World” command. 20:15:31 tux@linux-v415 ($ ldd ./a.out linux-vdso.so.1 => (0x00007fff171ff000) libc.so.6 => /lib64/libc.so.6 (0x00007fe56ef58000) /lib64/ld-linux-x86-64.so.2 (0x00007fe56f2e8000) 20:15:49 tux@linux-v415 ($20:15:31 tux@linux-v415 ($ ldd ./a.out linux-vdso.so.1 => (0x00007fff171ff000) libc.so.6 => /lib64/libc.so.6 (0x00007fe56ef58000) … Read more

Get information about your swap partition with this simple command.

This command will print information about your swap partition easily using the Linux command line. root@Yog-Sothoth:~# swapon -s -v Filename Type Size Used Priority /dev/sda5 partition 7811068 0 -2 /dev/dm-1 partition 62500860 0 -3root@Yog-Sothoth:~# swapon -s -v Filename Type Size Used Priority /dev/sda5 partition 7811068 0 -2 /dev/dm-1 partition 62500860 0 -3 The –show parameter … Read more

Some very useful bash scripting tips for testing the output of a program.

This simple shell script will test your Internet connection and then tell you if it is up or not. wgetvar=$(wget -q –tries=3 –timeout=20 –spider http://google.com)   if [ $? -eq ‘0’ ] then echo "Internet is up." else #some logging echo "Internet is down.." fiwgetvar=$(wget -q –tries=3 –timeout=20 –spider http://google.com) if [ $? -eq ‘0’ … Read more

How to copy text to a pastebin easily, and some other very useful tips.

This command will copy text to a pastebin online using curl. 4.4 Mon Sep 16 jason@Yog-Sothoth 0: $ echo "This is a message I want to save online." | curl -F file=@- https://0x0.st/4.4 Mon Sep 16 jason@Yog-Sothoth 0: $ echo "This is a message I want to save online." | curl -F file=@- https://0x0.st/ This … Read more

Nice web scraper to get a listing of all 4chan threads on a certain board.

This is a nice web scraper that will read a 4chan board and return a listing of all threads on that board page. This could be very useful code to expand into a useful script. #!/usr/bin/env bash   set -e   links=( $( wget "$@" -qo /dev/null -SO – | grep -oE ‘</span><a href=\"thread\/[0-9]+\"’ | … Read more

How to list all available WIFI access points with Linux.

Listing all available WIFI access points can be a hassle on Linux, but iwlist makes this very easy. It can be used to list verbose information about any WIFI access points that are near you. Used as root, it will list comprehensive information about each access point. Cell 08 – Address: 10:13:31:22:30:41 Channel:11 Frequency:2.462 GHz … Read more

Get information about the routing table on a mac computer.

This simple command will print the routing table from a Mac computer. deusexmachina:~ jason$ netstat -nr Routing tables   Internet: Destination Gateway Flags Refs Use Netif Expire default 192.168.1.1 UGSc 69 0 en0 127 127.0.0.1 UCS 0 0 lo0 127.0.0.1 127.0.0.1 UH 2 120 lo0 169.254 link#4 UCS 0 0 en0 192.168.1 link#4 UCS 0 … Read more

Interesting Linux commands that might be very useful.

List only directories with the Linux command line. This lists a directory with all folders listed first, then return only the listing of folders in the directory. 4.4 Tue Oct 09 jason@Yog-Sothoth 0: $ ls –color=auto –group-directories-first -Hul | head -n `echo */ | wc -w` total 3866624 drwxrwxrwx+ 6 jason jason 4096 Oct 9 … Read more

What a file hardlink means on Linux. And why symlinks are better.

Linux supports the creation of file hardlinks. This is a copy of a file that has the same inode as the original. If the copy is edited, the original is too. 4.4 Thu Oct 04 jason@Yog-Sothoth 0: $ ln missile.jpg missilenew.jpg 4.4 Thu Oct 04 jason@Yog-Sothoth 0: $ ls -hula -i -1 total 264K 14885009 … Read more