| by Scott Kilroy

Remove top navbar from wordpress

Edit wp-includes/functions.php and add the following add_action(‘after_setup_theme’, ‘remove_admin_bar’); function remove_admin_bar() { if (!current_user_can(‘administrator’) && !is_admin()) { show_admin_bar(false); } } Now the top navbar will only showup for admin users.

Share Button
Read More
| by Scott Kilroy

Find the largest file in a directory tree

find /path -type f -exec ls -s {} \; | sort -n | tail -1

Share Button
Read More
| by Scott Kilroy

Compress the contents current directory, but compress the smallest files first

ls -s | awk NR!=1 | sort -n | awk ‘{print $2}’ | xargs bzip2 -9v

Share Button
Read More
| by Scott Kilroy

Using netstat

netstat -ntulp displays everything that is listening tcp and udp and the ip that it is listening on

Share Button
Read More
| by Scott Kilroy

View network traffic (by port number)

To view web traffic (for example) use tcpdump -s 0 -w – port 80 | tcpdump -r – -A

Share Button
Read More
| by Scott Kilroy

VIM guide

A good basic starting point for using Vim isย http://www.pixelbeat.org/vim.tips.html

Share Button
Read More
| by Scott Kilroy

Filter duplicate lines from a sorted files

cat list-1 list-2 list-3 | sort | uniq > final.list

Share Button
Read More
| by Scott Kilroy

Debugging bash scripts

Debugg bash scripts by runing with option -x example bash -x scriptname.sh

Share Button
Read More