Mastering WSL Flashcards
What command will print the working directory?
pwd
What command is needed to list a directory’s content?
ls
How do I get a detailed list of a directory’s contents?
ls -l
What command will show hidden files in a directory?
ls -a
What command will get you instantly to the home directory?
cd ~
What command will let you make a new directory?
mkdir name
What command will create an empty file?
touch file_name
What command will let you move or rename a file?
mv source destination
How do you delete a file?
rm file_name
How do you delete a directory and its contents?
rm -r directory_name
How do you view a file’s contents from the wsl terminal?
cat file_name
How do you edit files from within a wsl terminal?
nano file_name
How do you display your username in wsl?
whoami
How do you show the computer’s system information?
uname -a
What command will refresh package lists?
sudo apt update
How do you install updates?
sudo apt upgrade
What commands will install and remove specific packages?
> sudo apt install package_name
> sudo apt remove package_name
How do you search for a specific file?
Use the find function. For example:
find . -name “.txt
What are some useful compiler flags for FORTRAN programs within wsl?
-Wall – Show all warnings (useful for debugging).
-O3 – Optimize for speed.
-g – Include debugging information.
-fcheck=all – Enable runtime checks (like array bounds).
-fopenmp – Enable OpenMP for parallel computing.
How do you compile a FORTRAN program with debuging symbols?
gfortran -g program.f90 -o program
gdb ./program
What are the different types of Linux shells?
- Bash (bourne again shell - most popular, usually the default.)
- Zsh (Z shell - extended version of bash with more plugins and themes)
- Ksh (Korn Shell - good for scripting)
- Fish (Friendly interactive shell)
From a wsl terminal, what is the command that lets you know what type of shell you are running?
echo $0
or
echo $SHELL