Use sed to filter text, this is very useful.

This sed sample will filter out all HTML opening and closing tags in HTML sed -e ‘s/<[^>]*>//g’ blog.txtsed -e ‘s/<[^>]*>//g’ blog.txt This is an example of the usage of this one-liner. 4.4 Sun Nov 11 jason@Yog-Sothoth 0: $ sed -e ‘s/<[^>]*>//g’ index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">…

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…

Read More

My system information program I coded for Linux a while ago. This works very well.

https://github.com/john302/sysinfo. This is my system information program I coded for Linux. This gives a bit of information about your Linux system. Just check out the source and type make to compile. Here is some sample output. 13:21:02 ~/Downloads/sysinfo.kdevelop-1.0 homer@neo $ ./sysinfo 1 –System name – Linux –Nodename – neo.deusexmachina –Release…

Read More

Very useful bash PS1 prompts.

A very colorful example that will really stand out. 4.4 Wed Aug 29 jason@Yog-Sothoth 0: $ Here is the code for this example. export PS1="\[\033[38;5;39m\]\v\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;83m\]\d\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;201m\]\u\[$(tput sgr0)\]\[\033[38;5;196m\]@\[$(tput sgr0)\]\[\033[38;5;51m\]\H\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;82m\]\l\[$(tput sgr0)\]\[\033[38;5;15m\]: \\$ \[$(tput sgr0)\]"export PS1="\[\033[38;5;39m\]\v\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;83m\]\d\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;201m\]\u\[$(tput sgr0)\]\[\033[38;5;196m\]@\[$(tput sgr0)\]\[\033[38;5;51m\]\H\[$(tput sgr0)\]\[\033[38;5;15m\]…

Read More

Very nice bash PS1 prompts.

A complex, but very useful bash shell prompt. PS1=$( sep=$'\xC2\xBB' # UTF-8 U+00BB red=$(tput setaf 1) green=$(tput setaf 2) yellow=$(tput setaf 3) blue=$(tput setaf 4) cyan=$(tput setaf 5) bold=$(tput bold) reset=$(tput sgr0) [[ $EUID -eq 0 ]] && user=$red || user=$green echo "\[$user\]\u@\h\[$reset\] \[$blue$bold\]$sep\[$reset\] \[$yellow\]\W\[$reset\] \[$blue$bold\]$sep\[$reset\] \[$user\]\$\[$reset\] ") Gives the…

Read More

how to generate long random numbers with the Linux command line.

This simple command prints out a long random number string from /dev/urandom. jason@Yog-Sothoth » img » $ tr -dc "[:digit:]" < /dev/urandom | head -c 64 ; echo 9958048462925775253231939134565711861924198983498274782350446110 Do it this way to remove the newline after the output. This would be good for use in a script. jason@Yog-Sothoth…

Read More

How to have a custom bash prompt that changes when you are in a certain folder.

This is how to create a custom bash prompt that will change if the user is in a certain folder, but is standard anywhere else. PS1="┌─╼ \$(if [[ \$PWD/ = \$HOME/anime/* ]]; then \ echo \"\[\e[1;35m\](\[\e[0;35m\] •\[\e[1;35m\]^ ω ^) \[\e[1;34m\]\$(pwd | sed ‘s|’$HOME/anime/’|アニメ |; s|’$HOME/anime’|アニメ |’)\[\e[0m\]\" \ ; else \…

Read More

How to get WIFI information with the command line.

It is very easy to get information about wireless networks with the command line. This example uses iwlist to view the information we need. jason@jason-Lenovo-H50-55:~$ sudo iwlist wlan0 scan | grep ESSID ESSID:"OPTUS58FFG69" ESSID:"TelstraD22F23" ESSID:"OPTUS58FFG69" ESSID:"TelstraD22F23" ESSID:"OPTUS_B8E926"jason@jason-Lenovo-H50-55:~$ sudo iwlist wlan0 scan | grep ESSID ESSID:"OPTUS58FFG69" ESSID:"TelstraD22F23" ESSID:"OPTUS58FFG69" ESSID:"TelstraD22F23" ESSID:"OPTUS_B8E926" This…

Read More

Very cool Linux text processing tricks.

Align all text right on an 80 column width. jason@jason-Lenovo-H50-55:~/Documents$ ls -hula | sed -e :a -e ‘s/^.\{1,80\}$/ &/;ta’ total 872K drwxr-xr-x 2 jason jason 4.0K May 4 08:48 . drwxr-xr-x 23 jason jason 4.0K May 3 20:51 .. -rw-r–r– 1 jason jason 848K Apr 21 13:01 altis_insurgency_altis.pbo -rwxrwxr-x 1…

Read More

Image manipulation with the Linux shell.

Emulate a Polaroid photo with the imagemagik package on Linux. convert lifeinCanberra_bg.jpg -polaroid 0 house.jpgconvert lifeinCanberra_bg.jpg -polaroid 0 house.jpg This is the original image. https://www.asis.gov.au/media/Images/Rebrand/lifeinCanberra_bg.jpg. And this is the image after manipulation. Double the size of an image, while retaining relatively good image quality. convert missile.jpg -magnify missilebig.jpgconvert missile.jpg -magnify…

Read More

A useful posting explaining why Linux does not need defragmenting.

If you are interested in how the Linux filesystem works, then this is a posting you really need to read: http://geekblog.oneandoneis2.org/index.php/2006/08/17/why_doesn_t_linux_need_defragmenting. This is a posting explaining how the Linux filesystem stores file and why it does not need to defragment the filesystem as it stores files more efficiently. I have…

Read More

How to have a nice text banner associated with your Linux user account.

Your Linux user account details may be seen with the finger command, i.e finger jason. But the user can add more information to this as well. Create a file in your home directory named .plan and put this into it. ***************************************************************************^M NOTICE TO USERS     This computer system is…

Read More