Machine Learning on Windows 10 – Part 2: Linux Command Line
In the last post we setup the Windows 10 WSL 2 subsystem, and deployed the latest version of Ubuntu.
In this post we will go over some common commands and features.
I will periodically update this post as I find new and interesting Linux\Windows commands.
- Launching Linux\Ubuntu Bash shell (Linux command line)
- Start Menu -> Ubuntu icon – This will bring up bash command line at the users home folder
- Launch Windows Command Line or PowerShell – Navigate to any directory. Type wsl and hit enter -> This will switch to the Ubuntu bash command line. WSL will mount the windows file system and cd into the same directory. For example, if the Windows Command prompt was at c:\Users\ekiss\Downloads then the ubuntu command line will be at /mnt/c/Users/ekiss/Downloads
- Microsoft has provided an updated console application called Windows Terminal. It can be downloaded from git (https://github.com/Microsoft/Terminal) or the Microsoft Store.
- You can call Windows binaries from the Linux command line and Linux binaries from the Windows command prompt. To run Linux binaries from the Windows Command Line, or PowerShell, enter wsl before the command. e.g. wsl ls
Common terminal commands
Below is a list that I compiled. Additional commands and descriptions can be found online: https://en.wikibooks.org/wiki/Guide_to_Unix/Commands/File_System_Utilities
Command | Description |
---|---|
man sudo_roo | How to run administrative commands |
apt list –upgradable | Get a list of packages that are available to update |
sudo apt-get update | To update the deployed packages |
pwd | Check which directory you’re in by entering (print working directory) |
ls ls – a | see what files are in the directory of your current path. -a shows hidden files and folders |
history | view list of recently used commands |
cd | change directory |
mkdir | make a new directory |
touch | create a new text file. e.g.: touch readme.txt |
vim | text editor. Exit by selecting Ctrl+C and then :q , or :wq if you want to save and quit |
nano | simple text editor |
cat | display file contents. e.g.: cat readme.txt |
man | See the manual pages for a command (for example, man tar ) or try typing a command plus --help to see how the command can be used (for example, nano --help ). |
sudo locate | The locate is a command line utility for finding files by name in Linux. Locate package is provided by the GNU findutils or mlocate packages. If the locate command is not found, run “sudo apt install mlocate “. After the package is installed, run “sudo updatedb“. Once the database is updated you can use the locate command. eg.: “sudo locate bash_completion.sh” |
python3 -m http.server | Start a python web server. Navigate to a folder with the html file and type the command. Open a browser and enter: http://localhost:8000/[webpage].html |
Resources:
https://www.tecmint.com/install-locate-command-to-find-files-in-centos/