Results 1 to 10 of 19
I have just started to learn how to use a terminal/command line and would like to know if it is possible to view a file whilst in a terminal. I ...
- 10-19-2009 #1Just Joined!
- Join Date
- Apr 2009
- Posts
- 98
how to view a file in a terminal
I have just started to learn how to use a terminal/command line and would like to know if it is possible to view a file whilst in a terminal. I am running Linux Mint 7.
I opened a terminal: branoo@computer ~ $
So i now added "ls" branoo@computer ~ $ ls
which listed all the directories.
I now wanted to access the Music directory so i used:
branoo@computer ~ $ cd Music
Which in turn produced a list of all the files within the Music directory
But could anyone tell me how i can view any of the files listed in the Music directory please
- 10-19-2009 #2forum.guy
- Join Date
- May 2004
- Location
- arch linux
- Posts
- 18,090
You can view text files by opening them using the cat command, or you can open them with vi or nano:
Code:cat file_name nano file_name
You can find some quick command line lessons and tips here:
LinuxCommand.org: Learn the Linux command line. Write shell scripts.oz
→ new members/users: read this first | new member faq
→ no private messages requesting computer support - post them on the forums!
→ please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.
- 10-19-2009 #3
One of the nice (or tortuous) things about the command line is that you select the program to open a file. This is why standardized file extensions are important -- they serve to show the user what is in the file. If for some reason you don't know what kind of file something is, you can use the file command, e.g. file unknown.uk.
For text files you can use cat to dump the whole thing, more to dump it succesively, less to dump it with scrolling enabled, and a clean terminal afterwards. vi is better if you need syntax highlighting and if you want to edit it.
For images, I use qiv, which is nice and simple.
For movies and audio, I use mplayer, which integrates nicely with the commandline.
Hope some of this helps.
- 10-19-2009 #4
Let's not forget the excellent text based file manager, midnight commander.
- 10-19-2009 #5Just Joined!
- Join Date
- Apr 2009
- Posts
- 98
I navigated to a Directory in this case called Music typed the "ls" command just so i could see that the file i wanted to view was there, and finally i typed:
branoo@computer ~ $ Music cat file_name and clicked on enter and was rewarded with the following output?
:creator><dc:description><rdf:Seq><rdf:li>()</rdf:li></rdf:Seq></dc:description></rdf
escription>
</rdf:RDF>
</x
mpmeta>
<?xpacket end='w'?>
endstream
endobj
2 0 obj
<</Producer(GPL Ghostscript 8.64)
/CreationDate(D:20090419161637+01'00')
/ModDate(D:20090419161637+01'00')
/Title(\376\377\000C\000:\000\\\000D\000o\000c\000u \000m\000e\000n\000t\000s\000 \000a\000n\000d\000 \000S\000e\000t\000t\000i\000n\000g\000s\000\\\000 D\000e\000b\000b\000i\000e\000\\\000M\000y\000 \000D\000o\000c\000u\000m\000e\000n\000t\000s\000\ \\000S\000c\000o\000r\000e\000s\000\\\000T\000r\00 0a\000d\000\\\000D\000o\000w\000n\000B\000y\000S\0 00a\000l\000l\000y\000G\000a\000r\000d\000e\000n\0 00s\000.\000s\000i\000b)
/Creator(\376\377\000P\000D\000F\000C\000r\000e\000 a\000t\000o\000r\000 \000V\000e\000r\000s\000i\000o\000n\000 \0000\000.\0009\000.\000
/Author(\376\377\000D\000e\000b\000b\000i\000e)
/Keywords()
/Subject()>>endobj
xref
0 21
0000000000 65535 f
0000002919 00000 n
0000009563 00000 n
0000002860 00000 n
0000002718 00000 n
0000000015 00000 n
0000002698 00000 n
0000003865 00000 n
0000005276 00000 n
0000004185 00000 n
0000003272 00000 n
0000004251 00000 n
0000003529 00000 n
0000002984 00000 n
0000004450 00000 n
0000005476 00000 n
0000003045 00000 n
0000003441 00000 n
0000003597 00000 n
0000004049 00000 n
0000007418 00000 n
trailer
<< /Size 21 /Root 1 0 R /Info 2 0 R
/ID [<DF5B589BAE57424CF586FC7EDFA6C50E><DF5B589BAE57424 CF586FC7EDFA6C50E>]
>>
startxref
10319
%%EOF
I haven't a clue what is going on here?
- 10-19-2009 #6Debian GNU/Linux -- You know you want it.
- 10-19-2009 #7Just Joined!
- Join Date
- Apr 2009
- Posts
- 98
And the same happened when i used the nano file_name command only it appears in a different type of language, code?
- 10-19-2009 #8Just Joined!
- Join Date
- Apr 2009
- Posts
- 98
Thought it would have appeared in every day readable English?
- 10-19-2009 #9forum.guy
- Join Date
- May 2004
- Location
- arch linux
- Posts
- 18,090
As noted earlier, nano and vi will allow you to open and read text files.
Are you sure that the files that you are trying to open using nano are text files?oz
→ new members/users: read this first | new member faq
→ no private messages requesting computer support - post them on the forums!
→ please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.
- 10-19-2009 #10
What do you mean by view a file in terminal ?
Code:stat file.mp3




