Page 1 of 2

This newbie has overcome his fear of the terminal

Posted: Thu Nov 01, 2018 6:41 am
by carum carvi
The Linux Command Line
Fourth Internet Edition
William Shotts

I saw a link in another newbies post who wanted to have a manual for learning command lines. I clicked it and now I am hooked. Learned more about how Linux works in an hour than in the past few months. Amazing.

I finally have overcome my fear of the terminal. Since I got myself entangled into a busybox several times with LM19 I understood the need to know some basic commands.

My first lesson with the Linux Command Line PDF was a warning NOT to use spaces in filenames. That is a habit I had copied from Windows. I now understand why it is better not to use spaces. It may seem like a little thing, but knowledge of many little things like these, surely make managing LinuxMInt even more easier.

Well, I just wanted to express my joy at learning to know the terminal better. A newbie victory over my fear of the terminal, lol...

Re: This newbie has overcome his fear of the terminal

Posted: Thu Nov 01, 2018 7:17 am
by deepakdeshp
Welcome to the terminal land

Re: This newbie has overcome his fear of the terminal

Posted: Thu Nov 01, 2018 9:35 am
by xenopeek
Sourceforge won't proceed with download so can't check what exactly the book said, but flat out saying you shouldn't use whitespace in filenames is weird. It's fine.

On the terminal you just have to remember to:
  • Quote filenames with whitespace in them, as in cat "my file.txt"
  • Or escape whitespace (prefix it with a backslash), as in cat my\ file.txt
  • Or use file globbing (which could match multiple files), as in cat my*.txt
Pressing Tab key on the terminal after typing a partial filename will auto-complete the name and add escapes for whitespaces where needed. I'd guess most use that.

Re: This newbie has overcome his fear of the terminal

Posted: Thu Nov 01, 2018 9:47 am
by HaveaMint
xenopeek wrote:
Thu Nov 01, 2018 9:35 am
Sourceforge won't proceed with download so can't check what exactly the book said, but flat out saying you shouldn't use whitespace in filenames is weird. It's fine.

On the terminal you just have to remember to:
  • Quote filenames with whitespace in them, as in cat "my file.txt"
  • Or escape whitespace (prefix it with a backslash), as in cat my\ file.txt
  • Or use file globbing (which could match multiple files), as in cat my*.txt
Pressing Tab key on the terminal after typing a partial filename will auto-complete the name and add escapes for whitespaces where needed. I'd guess most use that.
Even though I do know what you mean, I am waiting for the "I don't see any white spaces" :D
Selection_002.jpg
Selection_002.jpg (8.06 KiB) Viewed 783 times

Re: This newbie has overcome his fear of the terminal

Posted: Thu Nov 01, 2018 9:51 am
by gm10
HaveaMint wrote:
Thu Nov 01, 2018 9:47 am
"I don't see any white spaces" :D
Exactly. Stop the racial discrimination of spaces. Black spaces matter! :lol: :lol: :P

But seriously, not seeing a problem with spaces in file names, either. If anything they are the easiest special characters to deal with. Quotation marks, wild card characters and things like that as part of the actual file name can be much more annoying.

Code: Select all

$ touch "'Quote*\'this'"
$ ls
''\''Quote*\'\''this'\'''
Beautiful. :D

Re: This newbie has overcome his fear of the terminal

Posted: Thu Nov 01, 2018 9:54 am
by aes2011
xenopeek wrote:
Thu Nov 01, 2018 9:35 am
Sourceforge won't proceed with download
https://sourceforge.net/projects/linuxc ... stdownload worked for me. I used Google Chrome incognito mode with absolutely no ad/script blocker.

Re: This newbie has overcome his fear of the terminal

Posted: Thu Nov 01, 2018 10:01 am
by aes2011
While it's true that files with spaces in their names can be dealt with, I prefer to avoid spaces in files I create.

I like this oldish link on filenames: http://pclosmag.com/html/Issues/201607/page03.html

Re: This newbie has overcome his fear of the terminal

Posted: Thu Nov 01, 2018 10:07 am
by Faust
carum carvi wrote:
Thu Nov 01, 2018 6:41 am
......
I finally have overcome my fear of the terminal.
.....
My first lesson with the Linux Command Line PDF was a warning NOT to use spaces in filenames. That is a habit I had copied from Windows. I now understand why it is better not to use spaces. It may seem like a little thing, but knowledge of many little things like these, surely make managing LinuxMInt even more easier.
Congratulations !
Your life will be improved for evermore .....
...... OK , slight exaggeration :lol:

As to white-space in filenames ..... Don't do it ! .... just say no .
Keep yourself and your coding on the path of true purity ..... 8)

Why bother with having to escape characters in filenames ? .... it is twisted thinking and it makes no sense at all to me .

But I'm getting old , and I came to Linux with my old UNIX head on ..... call me old-fashioned if you will .... :mrgreen:

Re: This newbie has overcome his fear of the terminal

Posted: Thu Nov 01, 2018 11:47 am
by absque fenestris
I've been working with spaces in title names for 24 years (Mac first and Linux 15 years later).
That was my protest against DOS and Windows.
It's easier to read - for human beings and looks more beautiful.
Quite a lot of devices have broken down over time, but my backed up old and new data - with spaces in the titles - I can still read and edit...

Re: This newbie has overcome his fear of the terminal

Posted: Thu Nov 01, 2018 9:58 pm
by majpooper
aes2011 wrote:
Thu Nov 01, 2018 10:01 am
While it's true that files with spaces in their names can be dealt with, I prefer to avoid spaces in files I create.

I like this oldish link on filenames: http://pclosmag.com/html/Issues/201607/page03.html
I avoid spaces as well - just individual preference. Years ago in college I was taught myFile.txt approach which is now habit and works well for me but as xenopeek points out there are more than one to skin this cat (no pun intended).

Re: This newbie has overcome his fear of the terminal

Posted: Thu Nov 01, 2018 10:21 pm
by Flemur
carum carvi wrote:
Thu Nov 01, 2018 6:41 am
My first lesson with the Linux Command Line PDF was a warning NOT to use spaces in filenames.
Excellent advice. You can get around it as others described, but spaces will probably cause you trouble eventually (like when you don't expect files with spaces in the names), and there's not much of an upside. Almost no OS files contain spaces (just wallpaper names on my system)

Re: This newbie has overcome his fear of the terminal

Posted: Fri Nov 02, 2018 3:25 am
by xenopeek
Legibility or how do you folks keep your business and home administration in order.
2018-11-02_with_files_named_like_this.ods or 20181102WithFilesNamedLikeThis.ods?
I prefer "2018-11-02 With Files Named Like This.ods" as easier :)

Same with directory names; "My New Project" not my_new_project or MyNewProject.

I use names-like-this for scripts but certainly not stabbing my eyes with underscores, dashes or camelcase for everything else. If you're writing scripts where you deliberately go out of your way to not handle spaces in filenames, well sure. I can't think of an example where spaces are a problem.

Re: This newbie has overcome his fear of the terminal

Posted: Fri Nov 02, 2018 5:16 am
by carum carvi
"Though Linux supports long filenames which may contain embedded spaces and punctuation characters, limit the punctuation characters in the names offiles you create to period, dash, and underscore. Most importantly, do not embed spaces in filenames. If you want to represent spaces between words in a filename, use underscore characters. You will thank yourself later."

Quote from the LinuxCommandLIneManual pdf

I thought it would make it better understandable where my advice came from by quoting it.

One of two reasons why I did not started to use LinuxMint earlier was because of compatibility issues of files between Microsoft and Linux. Eager to not make the same mistake twice I was searching for the best way to name files in order to exchange them between my Linux and somebody else'Apple and Microsoft. But as is my experience with Linux when I have a problem Linux users come up with several solutions in no time. Thanks for the tips everybody how I can use spaces anyway.

But do these solutions (to still easily use spaces in linux files) still work when these Linux files have to be read by Windows or Apple?

Re: This newbie has overcome his fear of the terminal

Posted: Fri Nov 02, 2018 5:30 am
by gm10
carum carvi wrote:
Fri Nov 02, 2018 5:16 am
But do these solutions (to still easily use spaces in linux files) still work when these Linux files have to be read by Windows or Apple?
Both of those handle spaces just the same.

Re: This newbie has overcome his fear of the terminal

Posted: Fri Nov 02, 2018 6:13 am
by rene
For compatibility with NTFS (and VFAT and exFat) avoid these characters in filenames that are legal on UNIX: all characters with ASCII value less than 32 and value 127 (control characters) and \ * ? % : | < > "

Forward slash / is not allowed on UNIX by being the directory separator, and in fact not on Windows either where it's interchangeable with the disallowed backslash separator. Trailing periods or spaces also won't do.

With a possible exception for : I would suggest to avoid the above list \ * ? % : | < > " on UNIX as well and would add single quote '. Space I would not avoid, certainly not for e.g. music, but that means quoting and that means you really are best off without " or '.

Re: This newbie has overcome his fear of the terminal

Posted: Fri Nov 02, 2018 6:35 am
by aes2011
carum carvi wrote:
Thu Nov 01, 2018 6:41 am
My first lesson with the Linux Command Line PDF was a warning NOT to use spaces in filenames.
Here's at least one mention (on page 36 of OP's reference):
4.Though Linux supports long filenames which may contain embedded spaces
and punctuation characters, limit the punctuation characters in the names of
files you create to period, dash, and underscore. Most importantly, do not em-
bed spaces in filenames
. If you want to represent spaces between words in a
filename, use underscore characters. You will thank yourself later.
Of course, one will learn more, as Yoda teaches us, by using all sorts of characters in filenames :mrgreen:

Re: This newbie has overcome his fear of the terminal

Posted: Fri Nov 02, 2018 8:26 am
by lsemmens
I "grew up" with 8.3 filenames. When Long filenames were introduced in Windwoes way back when I did embrace it, however, I did not use a long filename to write "War and Peace". I will generally store files in folders related to the topic at hand. Even if that folder only contains one or two files. e.g. 2010Reconciliation contains all files related to that process. I do the same with all my music, Firstly grouped by music genre then by artist, then a subfolder of album. Much neater than RockPinkFloydTheWallTheWall . Isn't /Rock/PinkFloyd/TheWall/TheWall much neater?

Re: This newbie has overcome his fear of the terminal

Posted: Fri Nov 02, 2018 8:46 am
by gm10
lsemmens wrote:
Fri Nov 02, 2018 8:26 am
I "grew up" with 8.3 filenames. When Long filenames were introduced in Windwoes way back when I did embrace it, however, I did not use a long filename to write "War and Peace". I will generally store files in folders related to the topic at hand. Even if that folder only contains one or two files. e.g. 2010Reconciliation contains all files related to that process. I do the same with all my music, Firstly grouped by music genre then by artist, then a subfolder of album. Much neater than RockPinkFloydTheWallTheWall . Isn't /Rock/PinkFloyd/TheWall/TheWall much neater?
Dunno, it would be Pink Floyd - The Wall on my system, I find that much easier on the eyes. But I believe the point has been made: There's no technical reason not to use spaces in file names. You are free to name your files whichever way you prefer. Nothing more to say really.

Re: This newbie has overcome his fear of the terminal

Posted: Sat Nov 03, 2018 7:45 am
by Portreve
I don't really think much of the mindset or mentality which promotes the idea of sticking with tradition or habit or "what you know" over thinking for oneself, and honestly I have little use for those persons who function in that way, whether in the technology world or elsewhere.

There are certain specialized places and situations where one should not use spaces; however, generally, spaces are appropriate and make things, as has been alluded to above, much more human friendly. Can you imagine trying to read a newspaper where they didn't use spaces?

I use the terminal from time to time to accomplish certain specific tasks, but I operate on the desktop, so why spaces should be a problem, as far as I'm concerned, is normally just people preferring dogma over having to use their brain and think about what's actually appropriate for the situation.

Just my 2¢.

Re: This newbie has overcome his fear of the terminal

Posted: Sat Nov 03, 2018 9:31 am
by aes2011
Portreve wrote:
Sat Nov 03, 2018 7:45 am
I don't really think much of the mindset or mentality which promotes the idea of sticking with tradition or habit or "what you know" over thinking for oneself, and honestly I have little use for those persons who function in that way, whether in the technology world or elsewhere.

There are certain specialized places and situations where one should not use spaces; however, generally, spaces are appropriate and make things, as has been alluded to above, much more human friendly. Can you imagine trying to read a newspaper where they didn't use spaces?

I use the terminal from time to time to accomplish certain specific tasks, but I operate on the desktop, so why spaces should be a problem, as far as I'm concerned, is normally just people preferring dogma over having to use their brain and think about what's actually appropriate for the situation.

Just my 2¢.
What has reading newspapers got to do with a newcomer to the command-line?