Solved

mobaxterm not able to change directory

Posted on 2016-11-09
28
45 Views
Last Modified: 2016-11-17
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
0
Comment
Question by:gudii9
  • 18
  • 10
28 Comments
 
LVL 27

Accepted Solution

by:
serialband earned 500 total points
ID: 41880863
Well, it does look like MobaXterm is using unix style forward slashes.

Try
cd /xyz/abc/test


I haven't tried MobaXterm, but if it works similarly to Cywin, then C:\ may be under a special folder.  In cygwin, they use cd /cygdrive/c/ for c:\.
0
 
LVL 7

Author Comment

by:gudii9
ID: 41880884
What is cygdrive
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?
0
 
LVL 7

Author Comment

by:gudii9
ID: 41880947
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??)
0
 
LVL 27

Expert Comment

by:serialband
ID: 41881578
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.
0
 
LVL 7

Author Comment

by:gudii9
ID: 41884816
my goal is to run some shell script on windows environment

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?
0
 
LVL 27

Expert Comment

by:serialband
ID: 41884853
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.
0
 
LVL 7

Author Comment

by:gudii9
ID: 41886737
or mix it with windows syntax.
which one allows windows commands or mix of windows commands mostly?
0
 
LVL 27

Expert Comment

by:serialband
ID: 41887252
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?
0
 
LVL 7

Author Comment

by:gudii9
ID: 41888718
Are you trying to learn linux commands?
any good tutorial for this?
so mobaXterm uses linux commands right?
0
 
LVL 7

Author Comment

by:gudii9
ID: 41888722
i think i have to practice lot of linux commands. i am not even able to change directory properly
0
 
LVL 7

Author Comment

by:gudii9
ID: 41888741

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
0
 
LVL 7

Author Comment

by:gudii9
ID: 41888753
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
0
 
LVL 27

Expert Comment

by:serialband
ID: 41889167
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/
0
 
LVL 7

Author Comment

by:gudii9
ID: 41889692
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
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 7

Author Comment

by:gudii9
ID: 41889710
 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)

0
 
LVL 7

Author Comment

by:gudii9
ID: 41889741
http://images.linoxide.com/linux-cheat-sheet.pdf

above link do not have any CD related commands
0
 
LVL 27

Expert Comment

by:serialband
ID: 41889814
cd  /cygdrive/c/xyz/Abc/def/ghi/jkl/mno
0
 
LVL 7

Author Comment

by:gudii9
ID: 41889833
cd c/Users/ppp/qqq\ttt\kkk

above did not work
0
 
LVL 7

Author Comment

by:gudii9
ID: 41889858
/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?
0
 
LVL 27

Expert Comment

by:serialband
ID: 41890040
Linux/Unix is case sensitive.

Windows is case aware.

I'm not sure how MobaXterm does it.

cd c/Users/ppp/qqq\ttt\kkk

above did not work
You have to be in /cygdrive for that line to work.

If you want the full path, you need the /cygdrive/c prepended to the path.
0
 
LVL 7

Author Comment

by:gudii9
ID: 41890131
If you want the full path, you need the /cygdrive/c prepended to the path.

let me try
0
 
LVL 7

Author Comment

by:gudii9
ID: 41890139
cd cygdrive/c/Users/aaa/bbb/ccc/ddd/eee/fff

above worked
0
 
LVL 7

Author Comment

by:gudii9
ID: 41890142
CD cygdrive/c/Users/aaa/bbb/ccc/ddd/eee/fff
bash: CD: command not found


above did not work.

so case sensitive in linux
0
 
LVL 27

Expert Comment

by:serialband
ID: 41890182
You keep leaving out the root slash (/) in your response examples.

I used:
  cd  /cygdrive/c/Users/aaa/bbb/ccc/ddd/eee/fff

You used:
  cd  cygdrive/c/Users/aaa/bbb/ccc/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.
0
 
LVL 7

Author Comment

by:gudii9
ID: 41890301
➤ ./test.sh level 1

what it means by above command?
0
 
LVL 27

Expert Comment

by:serialband
ID: 41890341
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.sh level 1
0
 
LVL 7

Author Comment

by:gudii9
ID: 41890358
cd..
and
cd ..

are different?
apparently different
cd.. not working
0
 
LVL 27

Expert Comment

by:serialband
ID: 41890766
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?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now