在Windows中运行Linux bash命令的几种方法

如果你正在课程中正在学习  shell   脚本 ,那么需要使用  Linux   命令 来练习 命令 脚本

你的学校实验室可能安装了 Linux,但是你自己没有安装了 Linux 的笔记本电脑,而是像其他人一样的 Windows 计算机。你的作业需要运行 Linux 命令,你或许想知道如何在 Windows 上运行 Bash 命令和脚本。

你可以在双启动模式下同时安装 Windows 和 Linux。此方法能让你在启动计算机时选择 Linux 或 Windows。但是,为了运行 Linux 命令而使用单独分区的麻烦可能不适合所有人。

你也可以使用在线 Linux 终端,但你的作业无法保存。

好消息是,有几种方法可以在 Windows 中运行 Linux 命令,就像其他常规应用一样。不是很酷吗?

在 Windows 中使用 Linux 命令

作为一个热心的 Linux 用户和推广者,我希望看到越来越多的人使用“真正的” Linux,但我知道有时候,这不是优先考虑的问题。如果你只是想练习 Linux 来通过考试,可以使用这些方法之一在 Windows 上运行 Bash 命令。

1、在 Windows 10 上使用 Linux Bash  shell

你是否知道可以在 Windows 10 中运行 Linux 发行版? Windows 的 Linux 子系统 (WSL) 能让你在 Windows 中运行 Linux。即将推出的 WSL 版本将在 Windows 内部使用真正 Linux 内核。

此 WSL 也称为 Bash on Windows,它作为一个常规的 Windows 应用运行,并提供了一个命令行模式的 Linux 发行版。不要害怕命令行模式,因为你的目的是运行 Linux 命令。这就是你所需要的。

在 Windows 中运行 Linux bash 命令的几种方法在 Windows 中运行 Linux bash 命令的几种方法

Ubuntu Linux inside Windows

你可以在 Windows 应用商店中找到一些流行的 Linux 发行版,如 Ubuntu、Kali Linux、openSUSE 等。你只需像任何其他 Windows 应用一样下载和安装它。安装后,你可以运行所需的所有 Linux 命令。

在 Windows 中运行 Linux bash 命令的几种方法在 Windows 中运行 Linux bash 命令的几种方法

Linux distributions in Windows 10 Store

2、使用 Git Bash 在 Windows 上运行 Bash 命令

你可能知道 Git 是什么。它是由 Linux 创建者 Linus Torvalds 开发的版本控制系统。

Git for Windows 是一组工具,能让你在命令行和图形界面中使用 Git。Git for Windows 中包含的工具之一是 Git Bash。

Git Bash 为 Git 命令行提供了仿真层。除了 Git 命令,Git Bash 还支持许多 Bash 程序,如 ssh、scp、cat、find 等。

在 Windows 中运行 Linux bash 命令的几种方法在 Windows 中运行 Linux bash 命令的几种方法

Git Bash

换句话说,你可以使用 Git Bash 运行许多常见的 Linux/Bash 命令。

你可以从其网站免费下载和安装 Git for Windows 工具来在 Windows 中安装 Git Bash。

3、使用 Cygwin 在 Windows 中使用 Linux 命令

如果要在 Windows 中运行 Linux 命令,那么 Cygwin 是一个推荐的工具。Cygwin 创建于 1995 年,旨在提供一个原生运行于 Windows 中的 POSIX 兼容环境。Cygwin 是由 Red Hat 员工和许多其他志愿者维护的自由开源软件。

二十年来,Windows 用户使用 Cygwin 来运行和练习 Linux/Bash 命令。十多年前,我甚至用 Cygwin 来学习 Linux 命令。

在 Windows 中运行 Linux bash 命令的几种方法在 Windows 中运行 Linux bash 命令的几种方法

Cygwin

你可以从下面的官方网站下载 Cygwin。我还建议你参考这个 Cygwin 备忘录来开始使用。

4、在虚拟机中使用 Linux

另一种方法是使用虚拟化软件并在其中安装 Linux。这样,你可以在 Windows 中安装 Linux 发行版(带有图形界面)并像常规 Windows 应用一样运行它。

这种方法要求你的系统有大的内存,至少 4GB ,但如果你有超过 8GB 的内存那么更好。这里的好处是你可以真实地使用桌面 Linux。如果你喜欢这个界面,那么你可能会在以后决定切换到 Linux。

在 Windows 中运行 Linux bash 命令的几种方法在 Windows 中运行 Linux bash 命令的几种方法

Ubuntu Running in Virtual Machine Inside Windows

有两种流行的工具可在 Windows 上创建虚拟机,它们是 Oracle VirtualBox 和 VMware Workstation Player。你可以使用两者中的任何一个。就个人而言,我更喜欢 VirtualBox。

总结

运行 Linux 命令的最佳方法是使用 Linux。当选择不安装 Linux 时,这些工具能让你在 Windows 上运行 Linux 命令。都试试看,看哪种适合你。


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31524109/viewspace-2648281/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31524109/viewspace-2648281/

使用方法,解压到本地目录,配置path,即可在dos下使用linux命令windows下能直接执行的linux命令,基本包括日常所有,如:[.exe grolbp.exe regtool.exe a2p.exe grolj4.exe rm.exe a2p5.10.0.exe grops.exe rmdir.exe addftinfo.exe grotty.exe rmt.exe addr2line.exe gzip.exe run.exe alternatives.exe head.exe runcon.exe ar.exe hostid.exe rxvt.exe arch.exe hostname.exe scp.exe as.exe hpftodit.exe sdiff.exe ascii.exe i686-pc-cygwin-gcc-3.4.4.exe sed.exe ash.exe i686-pc-cygwin-gcc-3.exe semstat.exe awk.exe i686-pc-cygwin-gcc.exe semtool.exe banner.exe id.exe seq.exe base64.exe indxbib.exe setfacl.exe basename.exe info.exe setmetamode.exe bash.exe infokey.exe sftp-server.exe bigram.exe install-info.exe sftp.exe bunzip2.exe install.exe sh.exe bzcat.exe ipcrm.exe sha1sum.exe bzip2.exe ipcs.exe sha224sum.exe bzip2recover.exe join.exe sha256sum.exe c++filt.exe kill.exe sha384sum.exe cat.exe ld.exe sha512sum.exe cc-3.exe less.exe shmtool.exe cc.exe lessecho.exe shred.exe chcon.exe lesskey.exe shuf.exe chgrp.exe link.exe size.exe chmod.exe lkbib.exe sleep.exe chown.exe ln.exe soelim.exe chroot.exe locate.exe sort.exe cksum.exe login.exe split.exe cmp.exe logname.exe ssh-add.exe code.exe lookbib.exe ssh-agent.exe comm.exe lpr.exe ssh-keygen.exe conv.exe ls.exe ssh-keyscan.exe cp.exe make.exe ssh-keysign.exe cpp-3.exe makeinfo.exe ssh.exe cpp.exe man.exe sshd.exe crypt.exe man2html.exe ssp.exe csplit.exe manpath.exe stat.exe cut.exe md5sum.exe strace.exe cygcheck.exe mkdir.exe strings.exe cygpath.exe mkfifo.exe strip.exe cygrunsrv.exe mkgroup.exe stty.exe cygserver.exe mknod.exe su.exe cygstart.exe mkpasswd.exe sum.exe d2u.exe mkshortcut.exe svn.exe date.exe mktemp.exe svnadmin.exe dd.exe mount.exe svndumpfilter.exe df.exe msgtool.exe svnlook.exe diff.exe mv.exe svnsync.exe diff3.exe nc.exe svnversion.exe dir.exe ngettext.exe sync.exe dircolors.exe nice.exe tac.exe dirname.exe nl.exe tail.exe dlltool.exe nm.exe tar.exe dllwrap.exe nohup.exe tbl.exe dos2unix.exe objcopy.exe tee.exe du.exe objdump.exe test.exe dump.exe od.exe texindex.exe dumper.exe oldfind.exe tfmtodit.exe echo.exe openssl.exe touch.exe editrights.exe passwd.exe tr.exe egrep.exe paste.exe troff.exe env.exe pathchk.exe true.exe envsubst.exe peflags.exe tsort.exe eqn.exe perl.exe tty.exe expand.exe perl5.10.0.exe u2d.exe expr.exe pfbtops.exe umount.exe factor.exe pgawk-3.1.6.exe uname.exe false.exe pgawk.exe unexpand.exe fgrep.exe pic.exe uniq.exe find.exe pinky.exe unix2dos.exe fmt.exe post-grohtml.exe unlink.exe fold.exe pr.exe unprotoize-3.exe frcode.exe pre-grohtml.exe unprotoize.exe gawk-3.1.6.exe printenv.exe users.exe gawk.exe printf.exe vdir.exe gcc-3.exe protoize-3.exe vim.exe gcc.exe protoize.exe wc.exe gcov-3.exe ps.exe which.exe gcov.exe ptx.exe who.exe getclip.exe putclip.exe whoami.exe getfacl.exe pwd.exe windmc.exe gettext.exe ranlib.exe windres.exe gkill.exe readelf.exe xargs.exe gprof.exe readlink.exe xmlwf.exe grep.exe readshortcut.exe xxd.exe grn.exe realpath.exe yes.exe grodvi.exe rebase.exe zdump.exe groff.exe refer.exe zic.exe
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值