Basic commands used on linux terminal part 8
- W – this is a one character command with some very important features. This single command combines the work of two commands. Uptime and who both of those commands shows different results in a different format. But using this “w” command we can find a summary of the output of those two commands in a single output. It does not require any option. It’s just a one character command.
example: w - Alias – this is a procedure to create a long command into a short form or giving a command a different easy name for further use. Using this command we can create a masking name for a command that will be used a lot for system administration. It is easy to execute and few options are enough to work around.
example: alias [option] argument - Cmp – this is a better version of diff. using diff we can get the difference of the contents of two files. But this command helps find the difference between the bytes of two files. We can get detailed report using this command including the line numbers and the column numbers with each byte differences.
example: cmp [option] file1 file2 - Zip – it is a tool to compress files. It has two major responsibilities. First it reduces size of the file and second it packages the files in one file. The extension of this file will be “.zip”. this tool helps protecting files when you send them over a network. Usually we can confirm by file by using checksum.
example: zip [option] files.. - Unzip – this tool is used for extracting files from a zip file. It also can list and test the files. This file usually extracts data into the current directory or we can use to redirect the extraction point to extract data.
example: unzip [option] file.zip - Xargs – xargs is a very useful command for any linux system administrator. It usually echo the input if we don’t combine it with another command. If we combine this command with another linux command that it executes the command by putting the file’s content as the argument of the next command. This is very useful when we need to work with a very long list of files.
example: xargs [option] argument [ command] - Mkfs – make file system. This command is used for creating a file system on a physical block or logical block device. It usually sets the file format on the block device. So that we need to mention the file system right after the command mkfs. There are lots of file systems and we need to know the exact file system we require.
example: mkfs.file_system_name device name - Vi /vim/ Nano – the most popular and widely used text editor in the entire world. This is one of the in build text editor for any kind of text editors. It just not used for editing also it can create a new file. Also this gives the facility to open more than one file at the same time to compare and find the differences between files.
example: vim filename - Lsof – list of open files. This is a tool that can report every file is currently opened by the system and for which process or user it is opened. If we need to know which process is using which file, simply this command is more than enough to find. It also shows the process ID that is using the particular file.
example: lsof - cksum – this tool is used for checking the originality of the file that is being transferred or copied. We usually use this command after we transfer a file over network. It checks the CRC (cyclic redundancy check) and the byte of the file. This command is always used to check if the data is corrupted or not.
example: checksum filename