Results 1 to 8 of 8

Thread: using nano to navigate the linux file system

  1. #1
    Join Date
    Jul 2013
    Beans
    20

    using nano to navigate the linux file system

    Can't seem to get to grips with nano when i want to open a file in a different directory than Home. For example, if i wanted to start up nano and open a file at the same time (the file is in my Football directory), i typed: nano /Football/filename. But all i get is nano opens as a new file? Hope someone can help this noob, please.

  2. #2
    Join Date
    Apr 2012
    Beans
    7,256

    Re: using nano to navigate the linux file system

    The leading slash says 'start from the root of the filesystem tree' - if the file is in your Football directory that would be

    Code:
    /home/yourusername/Football/filename
    or, for short

    Code:
    ~/Football/filename

  3. #3
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: using nano to navigate the linux file system

    When in the home directory try the relative path

    Code:
    nano Football/filename
    or from any directory the absolute path

    Code:
    nano ~/Football/filename
    Tilde '~' is short for the home directory alias /home/$USER
    Last edited by sudodus; September 7th, 2013 at 06:24 PM. Reason: ninja'ed :-) by steeldriver

  4. #4
    Join Date
    Jul 2013
    Beans
    20

    Re: using nano to navigate the linux file system

    Very big thanks for the help guys

  5. #5
    Join Date
    Aug 2008
    Location
    Sweden
    Beans
    307
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: using nano to navigate the linux file system

    Could add that in Ubuntu you can see where you are located on your filesystem in the PS1 (the text prior to input is called that)

    Example: (below is my PS1)

    Code:
    r@i7:~$
    Means I am r, at computer i7, in folder ~.

    Code:
    r@i7:~/Dokument$
    Means I am in /home/r/Dokument, you get the idea...

    You can always type pwd to get full path or where you are located, and just like the guys explained above about path with nano, you use either full or relative path with cd to move around.

    Like cd /home/r takes me to ~ no matter where I am located. (or cd ~ or just cd for that matter)

    If I'd be in /home/ and type cd r it would also take me to ~.
    cd .. takes you to the parent-folder, aslong as you'r not located in /, which is the top.

    You can see what folders there are in the location you'r in using ls.
    Last edited by DarkAmbient; September 7th, 2013 at 09:37 PM.
    This is my signature

  6. #6
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,044
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: using nano to navigate the linux file system

    You can also use dot (.) notation. The dot means "here".

    Code:
    cd
    mkdir test_directory
    nano ./testdirectory/test_file.txt
    You can also use double dot (..) notation. Double dot means up one directory from here.

    Hence:

    Code:
    cd
    cd test_directory
    nano ../test_directory/test_file.txt
    I hope that sorted your football pool.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  7. #7
    Join Date
    May 2008
    Location
    UK
    Beans
    1,451
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: using nano to navigate the linux file system

    Just to be clear in case twsLeGR or any other new user is confused - the file name shortcuts that people have mentioned in this thread : ~, .., and . are not specific to nano - they work with every command that uses file names - they are provided by the command line interpreter which you are typing into.
    Tony - Happy to try to help.
    Unless otherwise stated - all code posted by me is untested. Remember to Mark the Thread as Solved.
    Ubuntu user number # 24044 Projects : TimeWarp - on the fly Backups

  8. #8
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,044
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: using nano to navigate the linux file system

    Yes, but that spoils the fun of picking winners in the football pool. And since we are talking about football, one needs to know how to bash.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •