Reminder of commands for Linux

In this post I will be putting some terminal commands that I use and it description



This command summarizes disk usage of each FILE, recursively for directories. Allows to check the size of a folder in the terminal.
-h Human Readable changes bytes for MB or GB
-s Summarizes


nmcli device show eth0 [or your iface ]| grep IP4

Returns information about the network interface, like DNS, routes, domain


This command doesn’t comes by default, but you can install it with apt-get and display some kind of file browser in the terminal.


Kind of task manager in the terminal


find /some/dir -type d -exec chgrp www-data {} +
Very powerful and useful command to search files in from the terminal and allows to execute commands with the results also like in the example above, check the man file for more.


Get current ACL’s for the given directory or file


Set ACL permissions to a directory (using the -R option) or file
setfacl -R -m u:dnetix:rwx /var/www
setfacl -R -m g:www-data:rwx /var/www
setfacl -x g:www-data /var/www (Removes permissions)


wc -l filename.some

Prints the line, word and byte count for a file or the text being piped to it, with the example command just displays the line count.


grep --exclude-dir={dir1,dir2,*.dst} -rnw /path/to/somewhere/ -e "pattern"

Although there is nothing new about this command, too often I need to search for a file that has an specific text (pattern will be better) so this command will do exactly that, just replace the path and keep in mind that pattern it’s a regular expression not a text.


ssh -t 'command1; command2'

Nothing new here, just want to remind how to send individual commands and then exit the connection

  • -t Allows user interaction, for example if command1 is vim or htop and you need to keep a connection while it last otherwise just ignore it


ssh-add -l

Manages private key identities to the authentication agent. Helpful options are:

  • -D Deletes all the cached keys used for the agent
  • -L Lists public keys
  • -l Lists private keys loaded by the agent



Displays all the routing that is configured for the actual networking settings and interfaces, pretty useful when using VPN connections


sudo lsof -wni tcp:80

Lists all the open files on your machine but in the example case outputs the command, PID and user that is using the port 80 in this case, really useful when you need to kill a process that is using a specific port



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s