Where are nano files stored?

So I just finished the ‘Learn the command line’ course and towards the end of the course we are introduced to nano. Now if I write something like ‘nano test’ it opens up the nano interface and creates a new file I think. When I press ctrl x where is that file stored. I’m asking because I accidentally wrote ‘nano .bash_profil’ and I’m wondering where that file is now stored. This was during one of the offline projects you can do in the course.

A few more quick questions:
-What is a script? Like what actually is scripting? If I write the ‘ls’ command and hit enter is that a script?
-Is using Python, for example, scripting?
-which backslashes are necessary when referencing filepaths? Because sometimes we need a backslash at the start AND at the end but sometimes it seems to make no difference, if you get what I’m asking
-When opening the bash profile setup in nano, is it necessary to write ‘nano ~/.bash_profile’ or can I just write ‘nano .bash_profile’? I guess this is kind of similar to the last bullet point

Honestly, I found that the command line course here was lacking (I’m being kind here) a lot of material and explanation. I think your best bet is to read documentation and look for free courses on YouTube and elsewhere.
In a previous job, I used the command line (on a Windows system, GNU) a lot and I learned most of it via online tutorials and cheat sheets for commands. That said, I’ve temporarily forgotten most of it. :woman_facepalming:t2: :joy:

https://linuxize.com/post/how-to-use-nano-text-editor/

I wouldn’t edit a bash profile. Unless it’s completely necessary.
https://linuxhint.com/simple-guide-to-create-open-edit-bash-profile/

Python is a scripting and a programming language. You can write scripts to automate tasks so you don’t have to repeat writing the same thing over and over.
https://www.python.org

Shell scripting is a computer program. You can navigate around your *nix file system and update or change files, making directories, executing programs, running commands on those files, etc.

Perhaps someone more well-versed can also chime in here if I’ve forgotten anything or muddled anything.

I can’t emphasize this enough (and I remind myself of it too at times)— a large part of being a good programmer is knowing how and where to find information when you’re stuck.

3 Likes

Hi,

I was noticing you were studying command-line.

You could try getting your bearings with some video tutorials. I highly recommend this playlist: https://youtube.com/playlist?list=PLy7Kah3WzqrHPrgkBgwzXyfDDCvthdUfl

You could also try getting a reference book if that’s more of your thing. I think Sam’s Teach Yourself Unix is very approachable if you haven’t done stuff like this before.

3 Likes

I think @lisalisaj ticked most of that off, for more information you’d want web searches since there’s no easy way to compress some of that info it a single reply.
Edit: @toastedpitabread makes a point that there’s plenty of good resources out there for this, make the most of them.

Regarding nano in particular it operates like most commands unless you specified otherwise it will be working in your current working directory (what would show up if you used pwd). So nano a.txt is much the same as writing nano ./a.txt, as in, create/open this file in this (the current) directory.

The ~ tilde is normally just a shorthand for the current users home directory $HOME, e.g. /home/myusername/. So nano ~/.bash_profile is asking nano to open the bash_profile file stored in your home directory (which is probably what you want). If you’re already in that directory then you could skip the alias, if you’re not in the home directory then you’re asking to open/create a file with that name in the current directory (which may not be what you want).

3 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.