Under this topic I would like to state some useful tips in services and systems. Hope this will be a huge collection on commands/shortcuts one day...
Good reference
- Finding the DNS bind version of a DNS server Command: dig version.bind txt chaos @dnsserver_ip
- Stop displaying BIND version to outsiders in version.bind query Just insert ' version "whatever you wan't to display for version queries"; ' to the options{}; E.g. options { directory "/var/named"; version "< HIDDEN >"; };
- Display the directories (folders) in Linux There are few ways of doing this in Linux.
- ls -d */ This will display the directories in the current working directory
- tree -d This will list the directories in tree structure
- echo */ This also displays the directories in a line. For example you can give the location as echo /home/* (which lists all the home folders of the users.)
- Accessing Zipped/Tar contents in Linux
- tar -t This will display or list the files/directories in the compressed archive.
- zcat file1 | grep -e "test" This will list all lines containing 'test' in the archived file file1. Similar to gunzip -c
- cut
- grep
Following commands are very rarely used but useful. Check whether you are familiar with them
- ss
- pstree
- This will display all the processes running currently along with associated child processes in tree format
- space
- Space is a command which can be used to cheat history command. If you type the command with a space before the command, that command will not be listed with history command
- check changed files in a directory (including sub directories) within a week and save details in to a file
find /path/to/the/directoty -mtime -7 -ls > changed_files
- remove unwanted contents and send the details to someone
Here the 'find' command will list the files changed within a week time in the given directory and its subdirectories and the details will be written to the changed_files file. Later if you identifies any unwanted data in the listed file details, you can delete using 'sed' command the the patten of the content which should be deleted. The 'nail' command can be used to send the filtered content to someone and -c switch can be used to cc the mail to some other mail recipient.
Good reference