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

19,869

Solution 1

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

Solution 2

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

Solution 3

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.

Share:
19,869

Related videos on Youtube

pisfire
Author by

pisfire

iOS App Developer, Android App Developer, ReactJS Developer, Flutter

Updated on September 17, 2022

Comments

  • pisfire
    pisfire over 1 year

    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

    • Chris Johnsen
      Chris Johnsen almost 14 years
      What 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?
    • pisfire
      pisfire almost 14 years
      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.
  • Chris Page
    Chris Page over 12 years
    You can also use Terminal's Shell > New Remote Connection to browse network computers and create an ssh session.
  • Chris Page
    Chris Page over 12 years
    As 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.
  • ALX
    ALX about 8 years
    I got the error "ssh: connect to host 10.3.32.1 port 22: Connection refused"
  • Nike Kov
    Nike Kov about 5 years
    smbtree not working on mac