There are several ways to read a text file. You can use one of several text editors, including vi, vim, emacs, joe, and nano. You can also parse it through the cat command like this:
cat nameoffile.txt | less
cat
This command followed by the name of the file is the most common way to display the contents of a file in all Unix-like operating systems, including Linux.
The simplest utility for viewing file content in the Linux Terminal, (Terminal as command promt also called DOS in Windows) its called the file command. The simplest utility for viewing file content in the Linux Terminal, (Terminal as command promt also called DOS in Windows) its called the file command.
The command is: diff file1.txt file2.txt
The command file will display what the type of the file is, even if it does not have a file extension. For example:user@hostname:~$ file image.pngimage.png: PNG image data, 639 x 480, 8-bit/color RGB, non-interlaceduser@hostname:~$ file picturepicture: JPEG image data, JFIF standard 1.01, comment: "CREATOR: gd-jpeg v1.0 (using IJ"
ls /this/dir/path > dirfile
$ cat filename | head
As files can be of any number of types, there is no single command that will do this. You would use the program associated with that file type to create a file. If you wanted to create a "blank" file, that has no content and uses no space, use the command touch filename.
On most Linux distros, try this command:$ df -m The df command is popularly considered to stand for disk free, though I don't really know if this is fact or myth.Caveat: The above command will only display information on mounted file systems.
In Linux the chmod command is used to set file permissions.
Tail command is used to display the last lines of the file.Syntax:tail -n 3 file1-n 3 = no. of linesfile1 = filename
ls -l | tr 'a-z' 'A-Z'
The 'head' command can only deal with the start of the file, not the end. If you want X number of lines at the end of the file then use the 'tail' command. tail -5 filename will list the last 5 lines of the contents of filename.
head