The history file is a log file of your last used commands on the Linux server,
It can be found in your home directory and is called .bash_history (with the “.” in the start).
You can either read the file itself to see its content, or use the command history which will do the same thing.
When looking at my history files on my Linux servers,
I can see maybe 20 Linux commands which I keep using over and over,
They are the most important tools of my work, and I recommend learning them well to any starting Linux sysadmin.
Files and Directories Management
- ls – Lists files and directories content, I usually use “ls -la” to have a long listing with all the details and hidden files
- cd – move from the current directory to a different folder
- pwd – lists your current location
- mv – this command can either change the name of a file, or move it to a different location.
- locate – find any file on the Linux server, to get an updated index of files (if for example you just installed a whole bunch of RPM’s) run the command updatedb
- ln – create a shortcut to a file or folder
- tar – create or extract files out of a storage file. with the correct arguments it will also compress the files
Editing and Viewing
- tail – lists the last 10 lines of a file, but you tell tell it to show any number of last lines
- vi – the best command line editing software a little hard to learn how to work this one at first, buts its worth the effort
- cat – list the content of the file. better know how long is the file you are running this command on, or you will get a very long scrolling of lines that will fill up your screen
A Very Good Linux Administration Book
- nslookup – very important networking tool – this will show you where a DNS name is pointing – to which IP or to another DNS
- wget – get a file from the web from the command line – if you need to download some RPM directly to the command line without a browser, this is the command you need
- ping – I think its one of the most used commands, you can check the time it takes you to get via the network to a remote server, whether that server is available, how many packets are getting to the server, etc
- history – lists the last used commands on your Linux server
- make – when compiling a software from source, this command will create the binaries
- id – who am I right now? besides the philosophical angle, this command will show you as which user you will be running commands, I use this to check what is my status, and then sudo to the user I need
- sudo – execute a command as another user – although usually use it to change to root
- ps – list the running processes on the server, it give more info like the process id, the parent process id, running time and much more
- man – displays a manual page, whenever you are not sure about a specific command or config file, you should run “man command” to get info about it. to search the man database use “whatis command” to find which man file has the info you need
- df – report file system disk space usage, use “df -h” to get a human formatted listing