When I try to use touch on my Windows computer, it says the command is not found. How can I use this on Windows?
Answer
A good program for emulating a Linux environment is the Git Bash terminal. That article will show you how to set it up on Windows – don’t worry about the Git stuff. That’s another tool you should definitely become familiar with, but the Git Bash terminal will allow you to use touch, mkdir, etc.
Hi, what is your reasoning behind not using ‘touch’ - especially as it is taught in the Command Line Course. Additionally, I’m afraid I don’t see the correlation between using ‘touch’ on BASH and ‘help’ on Windows. Could you clarify please?
If you have an updated Windows 10, then you can use WSL(Windows Subsystem for Linux). It is available for free from the Windows store. Just search for Ubuntu in Windows store and install it. For more information, check Microsoft’s website.
If you have any other version of windows, you can use emulator like cygwin.
then use powershell, its a lot more powerful and is also included in windows
WSL (windows subsystem for linux) is just linux running on windows. So then you still have a *nix based system.
because a lot of servers (for websites) run linux another unix derivative, which all use POSIX standards, which means a command working on linux also works on macOS and solaris. And servers often don’t come equipped with a GUI, so you will need to use the command line.
windows doesn’t honor POSIX standards, so yes, it makes sense you can’t use *nix commands on windows.
Use Windows PowerShell. If I knew this I wouldn’t waste my time installing WSL or Git Bash terminal. I’m not saying those two programs aren’t any good, I’m just finding it is easier to use Windows PowerShell to run the command lines teaching here instead of trying to install something that I, admittedly misunderstand its usage, and got mad when I couldn’t use it the way I want. I’m not gonna go into detail of my problems here to keep the answer short, but I just wanna say that knowing those programs are useful is good, but as a newbie – using Window PowerShell is way easier. I will learn to use those two programs in the future when I am more familiar with command lines.
I just tried powershell ( searched poweshell in start menu - windows 7) and tried all commands learned so far. It worked.
As I haven’t yet completed the course , its use is still not apparent to me as it seemed to be a simple file management system. On Wikipedia it says that it can be used to automate tasks. What kind of tasks are we talking here?
powershell is maybe even more powerful then bash (dunno, haven’t used powershell much), but especially with the .net eco-system from what i have heard/gathered.
file management is the thing you learn first, but you can do so much more. All kind of tasks can be automated. You can research it on the internet, its too broad for me to answer on this forum what bash is all capable of.
I think the best way to start diving into Linux is to get VirtualBox or somelike virtualization program and follow tutorial to get an Ubuntu system running in a window, in your Windows system.
Also you can dual boot.
Maybe not on your personal computer, but if you go into web development, you will find that many servers run linux. So knowing these commands can useful
there is a good change you will run into a *nix based operating system if you become a developer.
finally, you could be right and always use windows. Then this course is maybe not for you, that of course is a possibility.
I am also a windows user and am just starting out trying to learn SQL and then python. As I went through the course I got to the section to create my development environment on my computer and so got directed to take the command line course. I started to use Power shell. It seems to work, but found that “touch” does not work. I found I can use a function “fsutil” like this:
C:>fsutil file createnew emptyfile.txt 0
as long as I am running it as administrator. It produced this:
File C:\emptyfile.txt is created
Also found that in command prompt without being an administrator I can use: C:>type nul > empty.txt
Other commands seem to work: ‘ls’ works the same as ‘dir’; ‘md’ and ‘mkdir’ both work.
However, I don’t know if I will run into problems as I learn more commands. Should I stay with Powershell, or switch to something else? As a newbee it is hard to figure out and I can spend a lot of time spinning my wheels.
Thaniks
Once you gain enough experience, languages just become tools, and you use the right tool for the job.
If i had to develop an application in C# + .net, i would also use powershell, it juts fits together really well.
So in the end, it doesn’t matter. Learn what you need to do for the task at hand. If your intention is to build a web application with python (django, flask) and mysql or postgressql, hosting is more common on linux servers, so then learn bash.