ctors.net
Blog tvlooy

Linux server tools

lamp, linux | May 09, 2015

What tools do you install by default on your LAMP (and variants) server? These are mine.

aptitude

Aptitude is an ncurses interface on the Debian packages manager. I use it all the time. If you are on Ubuntu, aptitude is not installed by default anymore.

vim

Vim is an editor. I set it as the system default editor so everything works with vim. Eg: crontab -e, visudo, ...

Did you ever edited a file as regular user and couldn't save it because only root has write permissions? If you use vim, use this trick to save the file: :w ! sudo tee %.

tmux

Tmux is a terminal multiplexer. If you need to run a conversion script, want to alter you database, ... you don't want it to fail because your network connection is lost. Sometimes you just want to go home and not wait for these things to finish. Just fire up tmux and start your programs there.

If lose your network, just log in again and run tmux attach to get your session back. Want to go home? Just close your window or, in a more clean way, detach the connection with ctrl+b d and go home.

Tmux can split the screen into panes horizontally and vertically, multiple times. It can rotate between pane layouts, and can have multiple windows with other panes. You can also run multiple screen sessions at once.

htop

Htop is an ncurses based process viewer. It's something you would use instead of top.

zip unzip

Not all things are zipped with gzip or bzip2. Zip and unzip are two separate packages to work with .zip files.

tree

Shows directory listings in a tree structure. Where is waldo?

$ tree test test ├── bar │ ├── quux │ └── willy ├── baz │ ├── quux │ ├── waldo │ └── willy └── foo ├── quux └── willy

curl

Curl is not installed by default on some systems. It's useful as a debug tool to transfer data to and from a server. Often used with, but not limited to, HTTP.

tcpdump

Tcpdump is network sniffer. Most of the time I use it to write raw packets to a file (option -w) and read that file with Wireshark on a machine that has X installed.

percona-toolkit

If you are using MySQL or a fork (MariaDB, Percona) you will appreciate the Percona toolkit. It has a bunch of interesting tools like pt-summary, pt-mext, pt-index-usage, pt-query-adviser and my all time favourite pt-query-digest.

strace

Strace lets you trace system calls and signals. You can start a program by running strace program or attach strace to a running process with strace -p 1234 where 1234 would be the process id of the program of course.

gdb

Gdb is the GNU debugger. Can be useful to attach gdb to a running process and get a backtrace of where the process is stuck in the code. gdb -p 1234 and use command bt.

Performance

There is a bunch of other tools that you can install to investigate performance problems. I usually install these ad hoc. You should look at Brendan Gregg's Linux observability tools diagram for a good overview of these. Eg: sysdig is very interesting one.

So, what tools am I missing?