linux
3312NotesLinux2021-11-172025-08-24
as root user: sudo su
CTRL + L clear terminal
~ is the home directory of user
Sharing SSH keys between Windows and WSL 2
- copy the entrie
.sshfrom the windows pathc:\Users\<username>\.sshto linux dir~/.ssh
cp -r /mnt/c/Users/<username>/.ssh ~/.ssh
chmod 600 ~/.ssh/id_rsaset Read/Write access for the owner, and no access for anyone else. That means that nobody but you can see this key.
WSL
wsl --distribution Ubuntu-22.04wsl -lget distribution listwsl -s <distribution Name>set default distributionexplorer.exeopen file explorer
apt
apt --purge removeremove package and all their global (i.e., system wide) configuration files.apt list --installedwget "<url>"download from a url
dir
mv <name> <new name> rename dirmkdirrm -rf <dir> -r(recursive) -f(force)
File access
cat <file name> readcat > <file name> overthrow
mv <old name> <new name> rename a filerm remove
cp <options> <from path> <to path>copy dir or file- multiple from path is allowed
- options
-rrecursively copy-ito prompt if there are already existing files with same names in the destination folder-pto preserver it’s timestamp, filer permission, owner ship and so on
cutfind <path> -name <name | regular expression >search by file name or regular expression
vi editor
vi <file name> open vi editor:w save:wq or zz save and exit:q! exit without savingi insertd or <number>dd delete linesb to the beginning of the worde to the end of the word:u or :<number>u undo:set nu show line number:<line number> to the given line<number>yy yank multiple lines from the cursor position
Nano editor
ctrl + <command>
control+x to exit and save