Emacs tramp to edit remote files on Windows from Linux - windows

What is the best way to edit remote files on a Windows box (XP) from Linux?
I am running emacs 23.3 locally under Linux.
I would like to keep the extra software on the windows-box minimal, but I can install some extra software if needed. Cygwin is already there.

If cygwin is already there, running a sshd in the windows machine and using Tramp (maybe using the scp method) is the best option to my knowledge.

Related

Is 'Git Bash' classified as a virtual machine?

Is Git Bash classified as a virtual machine?
No, Git-Bash is not an emulator nor a virtual machine (WSL is, AFAIK). It's a port — software, written for Linux (and Unix in general) and compiled to run natively on w32.
In short, no this is not a virtual machine, this is an emulator.
based on this
In Windows, we tend to run commands in CMD but they are actually
executable files that exist in the C:\Windows\System32 folder. The
same case is for bash, it requires the utilities to make the commands
work. In Unix systems, these utilities will be under /usr/bin
directory. So, by installing the Git Bash these utilities will be
installed in C:\Program Files\Git\usr\bin folder.
This program actually installs commands that are created for windows runtime and used as in linux.

Learning UNIX Bash/Shell scripting on a windows enviornment

I was just curious if there are any tools out there that would allow me to practice shell scripting without dual booting my computer to half windows and half UNIX. I've heard of Cygwin but is that truly UNIX ?
Install Cygwin or install a Linux system under a virtual machine with emulators like VirtualBox.
Cygwin is not completely UNIX but it would be enough with not-too-system related scripting. There are differences though compared to a true UNIX system e.g. process managing wouldn't really work well. /proc too I think doesn't work as expected.
Cygwin is okay, but keep in mind that if you want to learn about UNIX, Cygwin won't help with learning about the Linux filesystem, which is important.
You could also have a look at How to develop in Linux-Like Shell (bash) on Windows?, maybe there are some helpful answers.
Personally, I think a Linux VM is your best option. Cygwin is a UNIX-like environment on top of Windows, it's not a UNIX emulator.
I generally install git with Windows installer. Not only it comes with bash (look for "git bash" in Start menu), it also comes with git (duh) and ssh.
Obviously that's not "truly unix", for that install Virtualbox and in it FreeBSD or some other *BSD (they are officially "unix", unlike Linux which is "just" unix-like).

VirtualBox VM access with cygwin

I cannot access my virtual machines from the cygwin console. (Windows 7, UAC is disabled)
Matthias#laptop0x4d53 /cygdrive/c/Program Files/Oracle/VirtualBox
$ ./VBoxManage list vms
The Windows console, however, has access to my virtual machines.
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe list vms
"GlassFish" {68874e4d-817a-4315-9ea2-38726964ac32}
"Tomcat" {2e22a7c0-9950-4593-8eda-778d404476c7}
"LAMP" {36aa6968-df52-49b5-be52-1f59c50f1527}
Maybe it's a problem with the user's rights. How can I access my VMs from cygwin also?
Did you try the official forums? There are some solutions exporting some variables on ~/.bashrc and starting VB in headless mode (this is a recent post, from 2011). There's even an ugly hack about exporting a bunch of environment variables using bat files instead.
#export VBOX_USER_HOME='/cygdrive/c/Documents\ and\ Settings/SomeNameHere/.VirtualBox/'
export VBOX_USER_HOME='C:\Documents and Settings\SomeNameHere\.VirtualBox\'
...or HOWTO - virtualbox as a service on Windows (cygrunsrv.exe). This is reported to be working on Cygwin 1.7b.
$ cygrunsrv --list
vboxd-myvm
This answer is in the spirit of 'consider this possibility' ;-)
How 'married' are you to cygwin as your unix tool on windows? My experience with cygwin is that is very slow but it's strength is that it comes with a wide range of linux-like tools AND probably has the largest user-support community.
There are at least 2 alternatives to cygwin that I use and can recommend AND with a quick test DID return the list of my active vms_s. They are UWIN and MinGW.
Read my writeup about ksh and UWIN here
Regarding 'for' loop in KornShell (2 nd msg)
ALSO check out the MinGW environment. I have installed MinGW primarily to have access to gcc (outside of cygwin) and it has a fair number of linux-like tools.
I hope this helps.
Easy to fix - you need to use Windows path syntax in your .bashrc
This -
VBOX_USER_HOME='C:\Documents and Settings\user.VirtualBox'
Instead of this -
VBOX_USER_HOME=/cygdrive/c/users/user/.VirtualBox

Practice Unix on Windows Machine

I want to practice Unix (mostly KornShell (ksh) scripting and VI editor) on a windows Vista machine. What is the best solution for this? I do not like Cygwin. So anything other than Cygwin which gives the closest feel of Unix Environment without re-installing the OS.
Thanks.
You can set up a virtual machine using VMware Player. http://www.vmware.com/products/player/
It lets you run a real *nix environment inside of Windows. It's free, and fairly easy to use.
I think Cygwin is really the easiest way to get what you're asking for, but another option might be MinGW. (Minimalist GNU for Windows).
If you just want to practice with specific command-line utilities, you could also look at: Unxutils.
Like others have said, you could also use a VM to install some type of Unix/Linux OS, like Ubuntu.
Solo es una sugerencia:
Why don't try instaling a virtual machine and then some unix?
Just a little suggestion
Get vim for Windows for vi practice (then get vim for your actual Unix box) and get Cygwin for a shell environment plus Unix utilities.
http://www.elitter.net/
Free shell accounts.
I would say the best way to practice it on your Windows machine is to install a virtual machine (e.g. virtual box, it's free) and set up Linux on that one. Then have them communicate through e.g. a shared folder.
But then there often are Windows clones of many of the most popular software on Unix/Linux systems.
If you want a good alternative to Cygwin, try UWIN.
More information on it can be found here.
I highly suggest that you download a version of unix. Here are some suggestions:
1. OpenBSD
2. NetBSD
3. FreeBSD
After downloading one of these, use virtualbox or vmware and install them in a virtual machine.
1. VirtualBox
2. VMware Player
This way you can easily run UNIX in a virtual environment and practice it easily. It's the most convenient method.
Also if you want you can install arch Linux which is very small and then install ksh shell in it using pacman and then change your default shell from bash to korn by this command chsh -s /bin/ksh. You can do all this in other Linux distributions too. Also if you are only looking for working with shell and vim you can use Ubuntu-server then install KornShell in it as well using sudo apt-get install ksh. It's entirely up to you which option do you wanna take.

Unix-style tools on Windows?

At work (a mostly Unix development shop), I've had an OS X box for the past 1.5 years and a Linux box before that. Due to various circumstances, I'll be getting a Windows XP laptop in the next few weeks. I'm of mixed feelings about this - it's good in that, as a manager, I'm used to running a Windows install (via Parallels) for Excel, Outlook, etc., but it's bad in that I'll miss all of the Unix tools available on OS X.
So, my question to you (community wiki perhaps?) is: What sort of tools would a Unix developer find handy when using a Windows machine? I'd like to be able to do some development on the machine (Perl, mostly), and also easily remote to other (Unix) machines. Here's what I've been recommended so far:
Editor: gvim
SSH: PuTTY
You want cygwin -- and secondarily, for when you absolutely have to work in a CMD.EXE console, unxutils.
Try MinGW, the Minimalist GNU for Windows. Here's a list of GNU tools they offer: http://sourceforge.net/projects/mingw/files/
This includes things like bash, sed, awk, grep, cut, and other familiar GNU tools. Perl is in there as well. I find it a good light-weight alternative to Cygwin.
On windows, you will miss the great GNU/Linux/Unix tools like sed, awk, wget, grep, tr, locate, file, dd, diff,
I wouldn't recommend cygwin though, I prefer native tools.
You can find native ports of the GNU tools at
http://gnuwin32.sourceforge.net/
Then you need a decent syntax highlighter, notepad is just an antique.
Geany is best on Linux, and there is a windows port:
http://www.geany.org/Download/Releases
There is also a windows port of The Gimp, free and opensource, offers the same and more functions as adobe photoshop (but with another interface). It's modest bit more difficult to use, though.
http://gimp-win.sourceforge.net/
For a C/C++/Lisp/Ada compiler and makefiles, you need MinGW, Minimalist GNU for Windows, together with msys (a linux like console).
Unlike cygwin, mingw and msys compile native win applications.
Windows doesn't have Perl installed by default.
You can download a free Perl interpreter from http://www.activestate.com/
Finally, you could install CoLinux, with which you can run Linux apps. on Windows.
CoLinux is hard to install, AFAIK, and you can mess up your computer if you don't know what you do.
If you have Vista Ultimate or XP, you can install SUA/WSU, Windows Services for Unix.
On Vista, it's in the OS Components tab under add/remove software in the control panel
On XP, you must download 300 MB from Microsoft.
Cygwin
Linux-like environment for Windows
making it possible to port software
running on POSIX systems (such as
Linux, BSD, and Unix systems) to
Windows.
Is your laptop good enough to run a VM? That will certainly get you the best of both worlds.
Instead of Cygwin or putty consider MobaXterm and maybe a few plug-ins.
No install needed and it is free; based on Cygwin code.
You just start a single executable file.
It includes the Busybox implementation of vi, sed, awk, wget, and grep, as well as openssh-server, ssh, scp, bash, rsync, X server, {lots more} and you can add things like perl, emacs (why?! :D ) screen, curl or python as plug-ins just by downloading them (versions from the mobaxterm site) into the same directory.
The tools in Busybox are not POSIX complete, but it is a pretty good start out-of-the-box.
It only takes a few minutes to be up & running.
Be sure to set up a persistent home directory and restart mobaxterm so you can keep your ssh keys, bash profile, etc. (ssh-keygen is included...)
You do not need to license it but you get a few extra goodies if you do.
The first thing I do on windows box is to download mobaxterm. I do not use putty anymore unless I have no choice.
main site: http://mobaxterm.mobatek.net/
some plugins: http://mobaxterm.mobatek.net/plugins.html
Just download the 'portable edition' zip file, extract it into a directory, open the executable {NOT the customizer...}, ignore any warnings, set a persistent home [Settings > Configuration > Misc Tab], close the application, restart the application, and then configure to your taste. This way all of your settings will be saved.
Now you can also make another directory to save logs to and turn on logging.
I like leaving 'Paste using right-click' "OFF" (unchecked) because it automatically pastes with a middle-button click anyway, like many terminals. BTW: Highlighting text adds it to your buffer/clipboard automatically.
TIP: try "cd /drives/c/foo/bar" or the like and then search & parse your windows log files with grep, sed & awk ...
DISCLAIMER: I do not work for mobatek or develop mobaxterm but I am a licensed user.
Cygwin gives you Unix command-line tools in a Windows environment.
If the cygwin installation is too heavy-weight for you, and the GnuWin32 installation is too cumbersome (you have to install every tool individually), you can also try out GOW: https://github.com/bmatzelle/gow. The only downside is that the binaries are quite old..
I know I'm late to the party here, however, another great option is Git Bash.
Well, best thing for me is Mobaxterm http://mobaxterm.mobatek.net/features.html
This Cygwin distribution has no installation at all as is one single binary only.
IMHO cmder is better in windows than cygwin to work with unix commands.
Better yet, when you install cygwin select the packages openssh, perl and emacs. Then install ssh daemon using ssh-host-config -y and follow instructions. Now you can ssh to your Windows machine from your Linux box, happily use vi or emacs and develop in Perl, run your perl code, or any other command line Windows exe, or Java or Python, etc. as long as they are console apps (vs a graphical one).
GO for Cygwin.
First install the Cygwin, which gives you a nice unix like terminal. You have lots of additional packages you can install online.
For stuffs like perl and python go for Activestate "http://www.activestate.com/activeperl"
http://www.activestate.com/activepython.
There is also "http://strawberryperl.com/" free, even for commercial usage.
It depends on what you wants:
Cygwin and it’s fork Mingw add Compatibility layer dlls on top of Win32, while SUA/INTERIX run on top of the NT with it’s own subsystem and PE type of executables beneficing many of the things traditionally implemented as *nix syscalls (like fork()) which are available in Native NT but not on WIN32.
So application have a some kind of better support, you can see it here.
Otherwise cygwin is fully supported by red hat which means a lot of binary packages are available while on SUA, the first thing you’ll probably need is to find a way to compile a recent toolchain with the outdated installed one.
I use the Git for Windows "contribute" version, aka msysgit: https://msysgit.github.io/#contribute
This single install includes: MSYS, MinGW, bash, GNU toolkit, gcc, g++, flex, bison, vim, gvim, ssh, git, svn, cvs, perl, tcl/tk, rxvt, etc. It's everything you would need to hack on git, and a good foundation for hacking on anything else.
msysgit takes up 1GB on the disk. (Windows Explorer will tell you it's 3GB, because it doesn't understand hard links.) It builds git from source, and there are a few large git repos.
MSYS+MinGW is lighter than Cygwin. It's better for porting, development, and for general use. It works both in the windows CMD prompt and in an rxvt terminal.
There is also MSYS2, I haven't tried it yet but I hear it is more up to date than msys or msysgit. See also: How are msys, msys2, and msysgit related to each other?
You can also try 'Install Windows Subsystem for Linux' in Win10. Link

Resources