notes_Linux
3171NOTESLinux2021-11-172024-12-07
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
.ssh
from the windows pathc:\Users\<username>\.ssh
to linux dir~/.ssh
cp -r /mnt/c/Users/<username>/.ssh ~/.ssh
chmod 600 ~/.ssh/id_rsa
set 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.04
wsl -l
get distribution listwsl -s <distribution Name>
set default distributionexplorer.exe
open file explorer
apt
apt --purge remove
remove package and all their global (i.e., system wide) configuration files.apt list --installed
wget "<url>"
download from a url
dir
mv <name> <new name>
rename dirmkdir
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
-r
recursively copy-i
to prompt if there are already existing files with same names in the destination folder-p
to preserver it’s timestamp, filer permission, owner ship and so on
cut
find <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>