How to jump on specific computer using terminal on Mac OS X

0

I know few commands regarding Mac OS X's Terminal like ls, cd, mkdir etc.

What I want to do is switch over a network computer - how ?

What I tried is as follows -

  • cd /
  • ls
  • cd Network
  • ls ( here I found no computers )

What exactly I am missing ?

Thanks in advance for sharing your knowledge.

Sagar

Sagar R. Kothari

Posted 2010-07-02T10:12:16.630

Reputation: 4 267

1What do you want to accomplish? “Jump”ing on a computer is a bit non-specific. Do you want to access another computer’s shared files? Do you want to run commands on another computer? Something else? – Chris Johnsen – 2010-07-02T11:30:29.843

Yep ! Same - @Chris - I want to jump to specific / another computer's shared files. As we can explore them using through finder - I want to do the same with terminal. – Sagar R. Kothari – 2010-07-02T11:36:29.377

Answers

6

You can use smbtree to list all shares. You can then use mount to mount the share and cd to navigate into it. Note that you need to create the folder you want to mount the share onto. (Alternatively you can mount the share using finder and just navigate to it via cd. They are mounted in /Volumes).

Here's an example of mounting a share, listing its contents and unmounting it again.

cd /Volumes
mkdir myshare
mount -t smbfs //guest@myhost/myshare myshare
ls myshare
umount myshare
rm -r myshare

igorw

Posted 2010-07-02T10:12:16.630

Reputation: 176

1smbtree not working on mac – Nik Kov – 2019-04-25T13:36:02.293

4

I would use SSH to log into the remote computer, then if you want to transfer any files use scp (SSH copy). A quick search on "SSH on OSX" should get you what you want, in general here are the steps:

1. open terminal on OSX
2. type "ssh [username]@[ip address of remote computer]"

now it's as if you opened terminal on that computer.

You will need to enable SSH in the remote computer's system preferences.

Here's one tutorial (there are many others): http://www.macosxhints.com/article.php?story=20010401050833391

Stin

Posted 2010-07-02T10:12:16.630

Reputation: 141

I got the error "ssh: connect to host 10.3.32.1 port 22: Connection refused" – ALX – 2016-04-21T23:55:17.903

You can also use Terminal's Shell > New Remote Connection to browse network computers and create an ssh session. – Chris Page – 2011-08-21T10:48:02.270

2

You can always use drag'n'drop: open terminal window, type cd (note space at end) connect to network share and drag it to terminal window, press enter…

Also, if you have bash 4.x, you can add shopt -s autocd to your ~/.bash_login or ~/.profile to skip typing cd part, just directory name.

tig

Posted 2010-07-02T10:12:16.630

Reputation: 3 906

1As of Mac OS X Lion 10.7, if you drag a directory (a folder or a server) onto a terminal tab in the tab bar, Terminal will automatically issue a cd command. Also, if you drag onto the tab bar, it will create a new tab at that directory. Dragging onto the Terminal application icon will create a new terminal window at that location. – Chris Page – 2011-08-21T10:49:58.383