How to navigate through local folders in command promt - cmd

I am a rookie who just started coding in python. I need to run the python files through cmd. Once I direct to a specific folder, I don't know the command line to direct me back to the root folder. Please do help in the earliest

"cd directory" will lead you to a folder
"cd .." will bring you back one folder up

Related

How to go to a specific file in Mac Terminal?

I'm trying to follow a walkthrough and this is one of the steps, "go to that same folder in Terminal (if you can't do that you should probably quit now)" I'm not very familiar with Mac's Terminal, but don't feel like quitting. If it helps, I need to run a grep -r "what I'm looking for" command on the file. I really have no idea what I need to do to run that command, but the rest of the walkthrough is pretty thorough, so I know I can follow the next few steps.
You need to move to the directory where that file is stored, for this the command is cd. For example lets say the file is located in a directory names MyDir in the Desktop, the command will be
cd /Users/{YOUR_USERNAME_HERE}/Desktop/MyDir
You can run ls command here to check if the file is actually present in this directory or not

Terminal - No such file or directory exists

So complete newbie question, but I've googled it and tried all their suggestions and I can't get it to work still :(
Trying to learn about the terminal... so I've created two files on my Desktop - filea.txt, fileb.txt - when I try to run the cd command I get the error, "No such file or directory exists".
I'm in the Desktop so that isn't the problem.
Is there anyone who could please suggest anything I can try?
I appreciate the help, and am completely grateful to anyone who answers - I understand time is valuable.
Thank you!
On an ubuntu to change to Desktop, you should type cd ~/Desktop, now you are in the Desktop directory, now typing ls would should list your files and directories on your desktop. Now you can open your file on a text editing application such as gedit by typing gedit filea.txt, which would open the file filea.txt in the text editor.
If you're trying to change directory to desktop and it's giving you that error, try typing cd .. which goes back one directory, and repeat to go back as far as you can and then try changing directory to desktop again.

Issue with win cmd finding folders

I am having an issue with the windows cmd line. When I cd into my Users dir my user folder shows as there but I cannot cd into. The path cd\Users\gmenfan83\ is my desired location. However, when I am in the Users dir and cd\Users\gmenfan83 \ I get a "The path is not found or specified" . I am more of a nix user but if the folder shows in the directory tree shouldn't I be able to cd into it? Thank you
Are you trying to use cd/Users/gmenfan83 while you have already used cd/Users? In that case you will not be able to find the file since you are already in the Users folder. Typing cd \Users\gmenfan83 right after opening cmd with C drive path should get you there.
It's unclear (even after your edit) what specifically you're doing, but this should get you started.
If you're currently in C:\users, and you want to change into the C:\Users\gmenfan83 folder, all you need is cd gmenfan83. If you're in C:\, all you need is cd users\gmenfan83.
Relative paths also work in Windows cmd.exe just as they do under *nix. To change from C:\users\gmenfan83\test to C:\users\gmenfan83\temp, you can use cd ..\temp, or specify cd \users\gmenfan83\temp.

Whats different when you executable a scripts in OSX?

I have a question I have been trying to fix for a while. I want to understand what's the difference between starting a script from the command line and making it executable and then running it from the Finder.
Because this is what I am experiencing;
I have a simple script called trash-files which contains this command:
trash ~/Downloads/*
When I run from the terminal it works as expected; however if I doubleclick the shell script in the finder I see this:
/Users/xx/Desktop/trash-files: line 1: trash: command not found
I hope anyone can tell me why this doesn't work as expected
trash is not a standard command in OS X. Is it something defined in your ~/.profile or a similar file? If so, these are not run for non-login shells, such as those created to run a script.
If you're using homebrew, you could run
brew install trash
which would install the necessary scripts to have the trash command work in the way you're expecting.
There is a folder in your home folder location called
.Trash
The "dot" in front of the folder name makes it hidden while searching for it in finder. You'll have to use Terminal to execute the following command:
cd ~/
ls -la
This will change the directory to the current logged in users home folder, then second command will list files and show hidden files. You can then run:
rm .Trash/*
This will remove everything inside the Trashcan on the dock.
So open TextEdit from the /Applications folder, go to "Format" and make it "Plain Text". Paste in the two lines below.
#!/bin/sh
rm ~/.Trash/*
Save the file as "emptyTrash.sh" (uncheck use txt extension). Save it to your Desktop or wherever you'd like. Then open Terminal, cd (change directory) to where the files is and run this command to make the script executable:
chmod +x emptyTrash.sh
Then you can execute the script by cd (changing directory) to path where the script is, and run:
./emptyTrash.sh
That's it.

msysGit Bash cannot escape its home directory?

I start the msysGit Bash using the provided batch file (the one that simulates a Linux environment). Bash starts up in msysGit's home directory (on my flashdrive). I would like to leave this directory to go to my project's directory (also on my flashdrive). So, I enter "$ cd .." This has no effect at all. I type "$ ls" and I'm definitely still in the Git folder. I try "cd ~" which brings me to my user folder, but I can't get to the root directory of my flashdrive. How can I get there with msysGit Bash?
I cannot use git-cmd.bat because the computers at my school deny access to cmd.exe.
Alternative question: How can I run git-cmd without needing administrator permissions?
If there is another distributed-model version control system that works better on portable devices (especially on systems where cmd is restricted and I'm not an administrator), I'll gladly switch to it (if you know of one, please tell).
You should be able to access the root directory of any drive by specify its driver letter:
(for instance)
cd /e

Resources