Linux Tricks
Search Files
To search files of a specified name (mysearchterm) in the path, use:
$ locate mysearchterm
Or do a comprehensive search for all files irrespective if they are in the path, use:
$ find / -name mysearchterm
To search a term in files, use grep
instead:
$ grep -r -e mysearchterm *
Testing an open ssh port
To find out any open ssh
ports online, use nmap
. It can be used to verify that a firewall is not blocking ssh
, when troubleshooting connectivity issues in a host.
nmap
has an option to ignore the host lookup, and generate a list of open ssh
ports. The command is:
nmap -P0 -sS -p 22 72.32.103.0/24
where:
-P0 | Ignore host lookup. |
-sS | SYN type connect test. |
-p portnumber | Specify port. |
Disk Usage / Free
To see disk usage for current directory:
$ du -h
To see disk free:
$ df -h