In the previous post we saw how to view / display the contents of a text file with more and less commands. What if you don't want to view the entire file contents? Say, you want to view only the first 10 lines of the file. Or you want to see only last few lines of the file. For that purpose we use the commands head and tail.
more and less are paging commands used in Unix/*nix systems to display contents of a file one screen at a time. The difference between more and less is that, less supports both forward and backward navigation through a file. Whereas more supports forward navigation but backward navigation is very much limited.
In Unix/*nix vi is the standard and widely used commands to edit/create a plain text file from the command line. vim (Vi IMproved ) is another text editor based on vi which can be run from a Command Line Interface as well as a Graphical User Interface.
" Unix is simple. It just takes a genius to understand its simplicity. " – Dennis Ritchie One of the advantage of Unix or *nix operating system is its simplicity. Beginners might find it hard to agree with me. But once you have familiarized with the OS and learned how to make use of it, you will discover the simplicity offered by Unix / *nix operating systems. Wildcards are one such concept which make Unix / *nix simple
cat command is one of the basic linux commands used to concatenate and write files. cat command can be used for the following major purposes View text files Create text files Append, Combine text files Copy a text file
To list the contents of a directory in linux use the ls command. ls command when used with out any argument will display the contents of the current directory.