Jump to content

Changing directories to a folder in home?

So Im new to linux. And im having trouble using cd. To run a script, using gui it simply doesn't work. no matter what I do or how I run it. However, dragging and dropping the .sh into terminal, removing the quotations, and running it that way works, and the program runs within the terminal, this is how I've been running things.

 

However, these files are located in /home/matt/Servers/[server folder]

                                                               user/\  

 

When dragging the file into terminal, it shows /home/matt/Servers/ect.

 

But when I manually type cd /home/matt, no such directory exits. I cant only go cd /home and get into my home, and no further. When using cd, "matt" simply doesn't exist. But when dragging the file, it clearly works? to execute these scripts to get a server or program running, do I simply type out the whole name and it will execute? But then I have to memorize the entire file route, where If I use a naming format I can move around the file system knowing what im doing.

 

Im new to the terminal and everything, do I just have a wrong understanding of how you navigate files?

Gaming - Ryzen 5800X3D | 64GB 3200mhz  MSI 6900 XT Mini-ITX SFF Build

Home Server (Unraid OS) - Ryzen 2700x | 48GB 3200mhz |  EVGA 1060 6GB | 6TB SSD Cache [3x2TB] 66TB HDD [11x6TB]

Link to comment
Share on other sites

Link to post
Share on other sites

8 hours ago, Nicholatian said:

It seems so.

 

It doesn’t seem you have a very clear understanding of how directories work in UNIX, and… you don’t do a very good job of explaining what your problem is.

 

Beginning a path with a tilde (~) is the same as prefixing it with your home directory. However if you put that in single or double quotes, the tilde won’t resolve (since sometimes you need a literal tilde), so to get your home directory without knowing it you can use $HOME inside double quotation marks.

 

If you want to cd to an absolute path, it needs to start with the file system root, meaning it needs to start with a slash. Changing directory to home/matt probably won’t work; you need to cd to /home/matt to get where you want. Or, more conveniently, use the shortcuts I described above.

 

Also, as a suggestion I think you should avoid capital letters in filenames wherever you can. They’re more cumbersome to type in the terminal as you have to reach over for the Shift key, which takes several milliseconds of time you otherwise could’ve saved. Just a protip.

thanks for the input. I ended up renaming all my files to lowercase (great tip). after some messing around I was then able to start my server purely through terminal.

Gaming - Ryzen 5800X3D | 64GB 3200mhz  MSI 6900 XT Mini-ITX SFF Build

Home Server (Unraid OS) - Ryzen 2700x | 48GB 3200mhz |  EVGA 1060 6GB | 6TB SSD Cache [3x2TB] 66TB HDD [11x6TB]

Link to comment
Share on other sites

Link to post
Share on other sites

Use tab completion.  When you start going down a directory tab tab and it will list all the options.  Also shell scripts need to be chmod 755 permissions.  Or run as sh ./blah .

 

Basics:

./ run from where I am currently

cd .. go back a directory

cd  takes you back to your home dir.

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×