mv test /location – move “test” to “/location” directory.cp -avr /path/dir1 /path/dir2 copies one directory (and contents) to another.'cp' -R -rf file location use this to do recursive overwrite without any prompt.cp oldname.txt newname.txt copies file to new name in same directory.cp test /location – copy “test” file or directory to “/location” directory.name *.ext -type f -delete deletes all files with “ext” extension including within subdirectories. rm -fv *.txt removes all files in current directory with “.txt” extension.rm -rf *test* – deletes all files/directories with the string “test” in the name.rm -rf test – deletes “test” directory without prompting you for every file. ![]() rm test – delete file or directory called “test”.mkdir test – make directory called “test”, rmdir test removes it.cd is relative whereas cd /directory is absoluteįiles & Directories (create, delete, move, copy, archive):.cd returns to default working directory in linux (ideally, the root but often not the case) cd or cd ~ goes to user home directory (of whichever user is logged in). ls -l – list files but also show permissions, # of hardlinks, file owner and group, size and modification time.ls, ls -a – list files in directory, use ls -S to sort by size or ls -Sr to reverse order, show hidden files.Navigating around command line ( full guide): cat /root/.ssh/id_rsa to see private key.cat /root/.ssh/id_rsa.pub to see public key.generate SSH key ssh-keygen -t rsa -b 4096, and press enter through all the prompts (about 3).ssh-add /Users/user/.ssh/id_rsa to load private key in terminal.TIP: sometimes when copying off the command line, it adds line-breaks that you need to delete when pasting elsewhere. cat /Users/ username/.ssh/id_rsa.pub to see public key, copy and import it to where you need.choose private key save location or leave empty for default /Users/ username/.ssh/id_rsa, choose passphrase for private key if you want (I usually leave empty).cat ~/.ssh/authorized_keys – lists authorized SSH keys.systemctl restart rvice – restart sshd.getting SSH port grep Port /etc/ssh/sshd_config (may need “sudo” in front)./etc/ssh/sshd_config – editing SSHD, changing SSH port number, allowing/disabling SSH or password authenthication, etc.Connect to ssh ssh -p 2222 (the -p and port number isn’t needed if using default port 22).Auto completion – hit the key while typing commands to auto complete names of directories and files.yum update – update server packages (useful before doing new software installs).passwd – change password for current user.“su -” is probably more proper since it creates a login shell with new environment. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |