Useful Linux Commands and Packages

Mostly generic but anything flavour specific will be for Ubuntu/Debian.

Useful Commands:

—————————————————————————————-

Clear the contents of a file:

 /bin/echo "" > 'filename'

—————————————————————————————-

Recursively search within a directory for files containing a certain string:

grep -Hrni 'search string' 'search path'

example: grep -Hrni #888888; /opt

—————————————————————————————-

Show where a command runs from:

whereis 'command'

example: whereis echo
echo: /bin/echo /usr/share/man/man1/echo.1.gz

—————————————————————————————-

Configure Static IP:

nano /etc/network/interfaces
auto eth0
 iface eth0 inet static
 address 192.0.2.7
 netmask 255.255.255.0
 gateway 192.0.2.254

—————————————————————————————-

Useful Packages:

To enable SSH access:

sudo apt-get install openssh-server

To install nano editor:

sudo apt-get install nano

To install mail utilities (provides CLI tools for mail):

sudo apt-get install mailutils

Leave a Reply

Your email address will not be published. Required fields are marked *