gudii9
asked on
mobaxterm not able to change directory
Hi,
i opened mobaterm terminal connection on my local windows laptop.
when i gave pwd it gave below as the present working directory
[2016-11-09 11:32.53] ~
[p1000.ZZ99999999] ➤ pwd
/home/mobaxterm
I am trying to go to different directory like
C:\xyz\abc\test
i gave cd C:\xyz\abc\test
i have sample.sh script under above test directory.
how to go to test directory and how to execute above command?
please advise
i opened mobaterm terminal connection on my local windows laptop.
when i gave pwd it gave below as the present working directory
[2016-11-09 11:32.53] ~
[p1000.ZZ99999999] ➤ pwd
/home/mobaxterm
I am trying to go to different directory like
C:\xyz\abc\test
i gave cd C:\xyz\abc\test
i have sample.sh script under above test directory.
how to go to test directory and how to execute above command?
please advise
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i mean like
cd xyz/abc
not like below
cd xyz\abc(which is windows path with backslash which do not works on mobiXterm not sure why??)
cd xyz/abc
not like below
cd xyz\abc(which is windows path with backslash which do not works on mobiXterm not sure why??)
I just tested the portable version of MobaXterm, and it looks like they incorporate cygwin ssh.
As I said, Unix uses forward slashes as a separator. The forward slash is in a easier location to reach. Windows got it backwards. In Unix/Linux, the backslash works as an escape character to identify special characters. You have to use forward slashes in MobaXterm, since it use a cygwin environment.
The /cygdrive/ folder is cygwin's special access to the drive letters. Unix doesn't use the drive letter followed by a colon, so they had to work around that syntax.
I'd rather just use the full cygwin and go full hog into unix/linux syntax or use the smaller putty.exe and plink.exe to use DOS syntax. MobaXterm seems to be missing the rest of cygwin.
As I said, Unix uses forward slashes as a separator. The forward slash is in a easier location to reach. Windows got it backwards. In Unix/Linux, the backslash works as an escape character to identify special characters. You have to use forward slashes in MobaXterm, since it use a cygwin environment.
The /cygdrive/ folder is cygwin's special access to the drive letters. Unix doesn't use the drive letter followed by a colon, so they had to work around that syntax.
I'd rather just use the full cygwin and go full hog into unix/linux syntax or use the smaller putty.exe and plink.exe to use DOS syntax. MobaXterm seems to be missing the rest of cygwin.
ASKER
my goal is to run some shell script on windows environment
how to do this?
is putty supports running shell scripts?
I'd rather just use the full cygwin and go full hog into unix/linux syntax
how to do this?
is putty supports running shell scripts?
Cygwin as a full separate package that you must install. It can be small, or it can be over a gigabyte of packages, depending on what you install. If you install it, you basically install the cygwin environment and you can install cygwin's packages of GNU/Linux tools. You basically type the same commands as in a full linux environment. The command syntax should be the same as you used in MobaXterm. Forward slashes are what the Unix/Linux world uses. I don't know exactly what commands are available in MobaXTerm, as I have not really used it.
With PuTTY, you can write DOS batch scripts to run plink.exe to send commands to unix systems. plink.exe is the command line script portion of the PuTTY suite.
Both Cygwin and Putty Suite are free. MobaXTerm looks to be free for personal use, but you must pay if you're not using it for personal uses. You should be able to script using any of them. I've just not used MobaXTerm.
It doesn't really matter which you use. It just depends on whether you want to use linux syntax or mix it with windows syntax.
With PuTTY, you can write DOS batch scripts to run plink.exe to send commands to unix systems. plink.exe is the command line script portion of the PuTTY suite.
Both Cygwin and Putty Suite are free. MobaXTerm looks to be free for personal use, but you must pay if you're not using it for personal uses. You should be able to script using any of them. I've just not used MobaXTerm.
It doesn't really matter which you use. It just depends on whether you want to use linux syntax or mix it with windows syntax.
ASKER
or mix it with windows syntax.which one allows windows commands or mix of windows commands mostly?
PuTTY suite's plink.exe lets you do that. What is it exactly that you want to do? Have you successfully changed the directory using the correct forward slashes in MobaXTerm? Did you find the correct drive in the Cygdrive directory? Are you trying to learn linux commands?
ASKER
Are you trying to learn linux commands?any good tutorial for this?
so mobaXterm uses linux commands right?
ASKER
i think i have to practice lot of linux commands. i am not even able to change directory properly
ASKER
I have to do CD../cd..
Then cygdrive/c
Then cd xyz/Abc etc
correction to my post
instead of above i have to do as below
I have to do cd ../.. //i wonder what is difference between cd ..//.. and cd ..//cd ..??
Then cygdrive/c
Then cd xyz/Abc etc
ASKER
also if my path is
Then cd xyz/Abc then i cannot directly go in one stroke
first go to c drive as below
cd c
then go to xyz drive as below
cd xyz
then go to Abc drive as below
cd Abc
how do we go instead directly to cd xyz/Abc
from C itself
once i opened local session did cd ../..
then give weird command as
cygdrive/c
then ls to see all folders there
here when i give
cd xyz/Abc
bash no such file or directory??
please advise
Then cd xyz/Abc then i cannot directly go in one stroke
first go to c drive as below
cd c
then go to xyz drive as below
cd xyz
then go to Abc drive as below
cd Abc
how do we go instead directly to cd xyz/Abc
from C itself
once i opened local session did cd ../..
then give weird command as
cygdrive/c
then ls to see all folders there
here when i give
cd xyz/Abc
bash no such file or directory??
please advise
In Linux, the root directory is just a single slash (/)
cd /
/ The root is the very base of the entire directory structure. Everything starts from there.
To get to the C:\ drive, no matter where you start, you can precede the directory structure with a forward slash and you will get there.
cd /cygdrive/c
If you're already at the root (/) directory, then you can leave off the preceding slash.
cd cygdrive/c
cd //
is the same as
cd /
.. = The parent directory, same as on Windows.
. = The current directory, same as on Windows.
To print the current directory
pwd
If you're in /cygdrive/c
cd ..
Takes you to
/cygdrive/
If you're in /cygdrive/c
cd ../..
Takes you to
/
Other than the C:\, the /cygdrive, and the direction of the slashes, directories and cd should work similarly in both Linux/Unix and Windows. Windows just uses a backslash (\) instead of a forward slash (/).
Here's a list of basic linux commands:
http://images.linoxide.com/linux-cheat-sheet.pdf
You can try this tutorial:
http://ryanstutorials.net/linuxtutorial/
http://www.linuxcommand.org/
Here are some linux video tutorials:
http://freevideolectures.com/blog/2012/04/5-websites-learning-linux/
cd /
/ The root is the very base of the entire directory structure. Everything starts from there.
To get to the C:\ drive, no matter where you start, you can precede the directory structure with a forward slash and you will get there.
cd /cygdrive/c
If you're already at the root (/) directory, then you can leave off the preceding slash.
cd cygdrive/c
cd //
is the same as
cd /
.. = The parent directory, same as on Windows.
. = The current directory, same as on Windows.
To print the current directory
pwd
If you're in /cygdrive/c
cd ..
Takes you to
/cygdrive/
If you're in /cygdrive/c
cd ../..
Takes you to
/
Other than the C:\, the /cygdrive, and the direction of the slashes, directories and cd should work similarly in both Linux/Unix and Windows. Windows just uses a backslash (\) instead of a forward slash (/).
Here's a list of basic linux commands:
http://images.linoxide.com/linux-cheat-sheet.pdf
You can try this tutorial:
http://ryanstutorials.net/linuxtutorial/
http://www.linuxcommand.org/
Here are some linux video tutorials:
http://freevideolectures.com/blog/2012/04/5-websites-learning-linux/
ASKER
lets say i am in C directory.
i want to jump 5 directories forward to mno directory like
c:/xyz/Abc/def/ghi/jkl/mno
how to do that. please advise
i want to jump 5 directories forward to mno directory like
c:/xyz/Abc/def/ghi/jkl/mno
how to do that. please advise
ASKER
cd // ( when i do this pwd shows // as present working directory)
is the same as
cd / ( when i do this pwd shows / as present working directory)
ASKER
cd /cygdrive/c/xyz/Abc/def/gh i/jkl/mno
ASKER
cd c/Users/ppp/qqq\ttt\kkk
above did not work
above did not work
ASKER
/cygdrive
➤ cd c
/cygdrive/c
➤ pwd
/cygdrive/c
➤ cd Users/aaa/bbb/ccc/ddd/eee/ fff
above worked as Users is under C
above worked as i am already in C should not use that in cd command but rest of relative path only
is it is case sensitive cd or CD makes difference?
➤ cd c
/cygdrive/c
➤ pwd
/cygdrive/c
➤ cd Users/aaa/bbb/ccc/ddd/eee/
above worked as Users is under C
above worked as i am already in C should not use that in cd command but rest of relative path only
is it is case sensitive cd or CD makes difference?
Linux/Unix is case sensitive.
Windows is case aware.
I'm not sure how MobaXterm does it.
If you want the full path, you need the /cygdrive/c prepended to the path.
Windows is case aware.
I'm not sure how MobaXterm does it.
cd c/Users/ppp/qqq\ttt\kkkYou have to be in /cygdrive for that line to work.
above did not work
If you want the full path, you need the /cygdrive/c prepended to the path.
ASKER
If you want the full path, you need the /cygdrive/c prepended to the path.
let me try
let me try
ASKER
cd cygdrive/c/Users/aaa/bbb/c cc/ddd/eee /fff
above worked
above worked
ASKER
CD cygdrive/c/Users/aaa/bbb/c cc/ddd/eee /fff
bash: CD: command not found
above did not work.
so case sensitive in linux
bash: CD: command not found
above did not work.
so case sensitive in linux
You keep leaving out the root slash (/) in your response examples.
I used:
cd /cygdrive/c/Users/aaa/bbb/ ccc/ddd/ee e/fff
You used:
cd cygdrive/c/Users/aaa/bbb/c cc/ddd/eee /fff
Please note, that they do mean different things. If you start out in root (/), then both will work. You're using a relative path, so you won't be able to use that to navigate if you start in another path. I used an absolute path by placing the slash (/) at the very front of the path.
I used:
cd /cygdrive/c/Users/aaa/bbb/
You used:
cd cygdrive/c/Users/aaa/bbb/c
Please note, that they do mean different things. If you start out in root (/), then both will work. You're using a relative path, so you won't be able to use that to navigate if you start in another path. I used an absolute path by placing the slash (/) at the very front of the path.
ASKER
➤ ./test.sh level 1
what it means by above command?
what it means by above command?
It means run the command script file test.sh from the current directory.
You use the dot (.) to indicate current directory. Since it's the directory, you need the slash (/) to separate it from the command. You only need to do this if the command is not in your defined $PATH.
If the command was in your defined $PATH, you would be able to run the command without the dot-slash (./).
test.sh level 1
Since it's not in your path, you must include the directory path to the command.
The test.sh command is taking to arguments, level and 1. Those will be processed by the directives inside of test.sh.
This would have worked also.
/cygdrive/c/xyz/abc/test.s h level 1
You use the dot (.) to indicate current directory. Since it's the directory, you need the slash (/) to separate it from the command. You only need to do this if the command is not in your defined $PATH.
If the command was in your defined $PATH, you would be able to run the command without the dot-slash (./).
test.sh level 1
Since it's not in your path, you must include the directory path to the command.
The test.sh command is taking to arguments, level and 1. Those will be processed by the directives inside of test.sh.
This would have worked also.
/cygdrive/c/xyz/abc/test.s
ASKER
cd..
and
cd ..
are different?
apparently different
cd.. not working
and
cd ..
are different?
apparently different
cd.. not working
In Windows cd.., works because they split the command from the .. parent directory symbols.
In linux/unix, commands and arguments must be separated by a space. There is no command named cd.. in linux/unix. You could name an alias and make it become cd .. if you wish.
If you aliased it, it would then work.
alias cd..="cd .."
Have you visited some of the linux tutorial pages yet?
In linux/unix, commands and arguments must be separated by a space. There is no command named cd.. in linux/unix. You could name an alias and make it become cd .. if you wish.
If you aliased it, it would then work.
alias cd..="cd .."
Have you visited some of the linux tutorial pages yet?
ASKER
I have to do CD../cd..
Then cygdrive/c
Then cd xyz/Abc etc
It is not allowing forward slash but allowing backward slash Sas it thinks escape character?