element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Interfaces
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 12 replies
  • Subscribers 678 subscribers
  • Views 1071 views
  • Users 0 members are here
  • raspberry_pi
Related

Interfaces

rincewind1
rincewind1 over 12 years ago

I am trying to access sudo nano  /network/interfaces on my new pi the nano screen opens but has no content and if I try to type and save I get message file does not exist, I am a beginner trying to run pi from laptop but cannot get pi to have a static IP address due to this, can you help?

I think I have tried everything

  • Sign in to reply
  • Cancel
Parents
  • Former Member
    Former Member over 12 years ago

    Hi Adrian,

     

    I sympathize with your frustration on this.  I'm a Windows guy and linux is a different world.  Fortunately, I've been around long enough to have delt with DOS which is also a command-line environment.  I am in no way a linux expert so I hope I don't mislead you anywhere, and those who know, please correct me if I do.

     

    I'd suggest you take a breath and spend some time with the "bash" command line and understand the file system.

     

    Lets break it down: What you're trying to do in the command  "sudo nano /etc/network/interfaces" is three things:

     

    First thing to remember is upper/lower case counts!

     

    1. sudo: this is a request to the bash shell to allow you special priviliges to write to a system level file.  This kind of file is restricted from normal use.  By typing 'sudo' you're telling the bash shell "OK I know what I'm doing so let me edit and save this file"

     

    2. nano: this is a text editor, so you're invoking the program nano.

     

    3. /etc/network/interfaces: this is the file you want to edit.

     

    However, for nano to find the file it has to follow the path you give it.  The path starts from where you are and nano (or any program you give a path to) has to be able to see the sign-posts of each part of the path.

     

    So to orient yourself with respect to your starting position, bash can respond to a command called 'pwd'.  If you type those characters (lower case only) on the command line bash will respond with the directory you're currently in.  I think 'pwd' stands for 'present working directory'.  Anyway, then you can know where you are. 

     

    The next thing to do is type 'ls' (lowercase 'L'). That gives you the items and directories that are in the directory you're in.  If you like you can type 'ls -l' (no quotes)  the minus L is a request to list out the directory contents vertically rather than in a simple word-wrap way.

     

    So, getting back to the path: /etc/network/interfaces.  when you give the path the nano takes it apart slash by slash.  It looks for the 'etc' signpost in the items of the directory you're in.  If it's there it determines whether it's a file or another directory.  If it's a directory it goes to that directory and looks for the next piece: 'network'.  if it finds it, it again determines whether it's a file or a directory.  If it's a directory it again follows the signpost to that location and selects the next part of the path: 'interfaces'. 

     

    As you might expect, the last piece of the path should be a file that nano can open.  Every section prior to that in the path should be a directory since a path is intended to be an 'address' of a single entity.

     

    So, to finally get to the answer of your most recent question:

     

    >> I am trying to access sudo nano  /network/interfaces on my new pi the nano screen opens but has no content.

     

    If your pwd directory doesn't have the first piece the '/etc' you might get this situation.

     

     

     

    Believe me, learning linux is a step back in time for me.  Many people swear by linux, and I'm sure it does many great things.  It's lean which is needed in a Raspberry Pi/ arduino environment and works well in computing intensive scientific scenarios.  But it's a huge paradyme shift that takes some patience (and courage).  If you're serious about learning it you have to take the time to learn it.

     

    Best regards,

     

    Lou

     

    I hope this helps.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Former Member
    Former Member over 12 years ago

    Hi Adrian,

     

    I sympathize with your frustration on this.  I'm a Windows guy and linux is a different world.  Fortunately, I've been around long enough to have delt with DOS which is also a command-line environment.  I am in no way a linux expert so I hope I don't mislead you anywhere, and those who know, please correct me if I do.

     

    I'd suggest you take a breath and spend some time with the "bash" command line and understand the file system.

     

    Lets break it down: What you're trying to do in the command  "sudo nano /etc/network/interfaces" is three things:

     

    First thing to remember is upper/lower case counts!

     

    1. sudo: this is a request to the bash shell to allow you special priviliges to write to a system level file.  This kind of file is restricted from normal use.  By typing 'sudo' you're telling the bash shell "OK I know what I'm doing so let me edit and save this file"

     

    2. nano: this is a text editor, so you're invoking the program nano.

     

    3. /etc/network/interfaces: this is the file you want to edit.

     

    However, for nano to find the file it has to follow the path you give it.  The path starts from where you are and nano (or any program you give a path to) has to be able to see the sign-posts of each part of the path.

     

    So to orient yourself with respect to your starting position, bash can respond to a command called 'pwd'.  If you type those characters (lower case only) on the command line bash will respond with the directory you're currently in.  I think 'pwd' stands for 'present working directory'.  Anyway, then you can know where you are. 

     

    The next thing to do is type 'ls' (lowercase 'L'). That gives you the items and directories that are in the directory you're in.  If you like you can type 'ls -l' (no quotes)  the minus L is a request to list out the directory contents vertically rather than in a simple word-wrap way.

     

    So, getting back to the path: /etc/network/interfaces.  when you give the path the nano takes it apart slash by slash.  It looks for the 'etc' signpost in the items of the directory you're in.  If it's there it determines whether it's a file or another directory.  If it's a directory it goes to that directory and looks for the next piece: 'network'.  if it finds it, it again determines whether it's a file or a directory.  If it's a directory it again follows the signpost to that location and selects the next part of the path: 'interfaces'. 

     

    As you might expect, the last piece of the path should be a file that nano can open.  Every section prior to that in the path should be a directory since a path is intended to be an 'address' of a single entity.

     

    So, to finally get to the answer of your most recent question:

     

    >> I am trying to access sudo nano  /network/interfaces on my new pi the nano screen opens but has no content.

     

    If your pwd directory doesn't have the first piece the '/etc' you might get this situation.

     

     

     

    Believe me, learning linux is a step back in time for me.  Many people swear by linux, and I'm sure it does many great things.  It's lean which is needed in a Raspberry Pi/ arduino environment and works well in computing intensive scientific scenarios.  But it's a huge paradyme shift that takes some patience (and courage).  If you're serious about learning it you have to take the time to learn it.

     

    Best regards,

     

    Lou

     

    I hope this helps.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    If your pwd directory doesn't have the first piece the '/etc' you might get this situation.

    The slash on the front of "/etc" has a special meaning, it means to look for "etc"

    in the root directory, rather than in the current directory shown by pwd.

     

    But other than that, your suggestion is a good one, to use the ls command in the

    root directory to see that etc is there, and in the etc directory to see that network is there,

    and in the network directory to see that interfaces is there.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    Ah, okay so the leading '/' starts from the 'root' directory? 

     

    If I started from the root as my pwd and typed 'etc/network/interfaces' would I get what I needed?

     

    Alternatively when typing /network/interfaces would fail to find the file since it's assuming '/network' is at the root... right?

     

    Thanks for the guidance.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    If I started from the root as my pwd and typed 'etc/network/interfaces' would I get what I needed?

     

    Alternatively when typing /network/interfaces would fail to find the file since it's assuming '/network' is at the root... right?

    yes, exactly.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • rincewind1
    rincewind1 over 12 years ago in reply to Former Member

    Thank you to all for your help, that problem is now sorted

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube