[ Linux/Ubuntu ] 리눅스 단축키, 명령어 모음
단축키 또는 명령어를 잘 알고 있으면 훨씬 빠르고 간단하게 사용이 가능합니다.
자주 사용하다보면 필요에 의해서 기억하게 될겁니다..
아래의 모음은 제가 직접 하나씩 정리해봤습니다(우분투 20.04).
메모장으로 정리해둔걸 옮기다 보니 영어로 적어둔게 많네요..
최종 작성일(2021.08.04)
##############################################################################
linux short cut
##############################################################################
Index
- Server comands (ssh, scp)
- tmux
- Terminal Shortcuts
- Terminal File Commands (df, ls, cd, mkdir, pwd, rm, cp, touch, cat, mv)
- Terminal Process Management (ps, top, htop)
- Terminal Final permissions (id, chmod)
- Linux Shortcuts(Normal & Browser)
##############################################################################
ssh comands
서버에 보안 연결시 사용.
ssh -p 포트숫자 id@ip
ssh options(server)
-p : Port to connect to on the remote host
-q : Quiet mode(ignore the warnings)
-v : Verbose mode
-V : Display the version number
-X : Enables X11 forwarding
##############################################################################
scp comands (copies files between hosts on a network)
로컬 컴퓨터와 서버의 파일 전송하는 명령어 (directory도 가능)
scp options
-P : (** Capital P **)Port to connect to on the remote host
-p : Preserves modification times, access time and modes from the original file
-r : *****Copy the Directory(recursively)*****
-v : Verbose mode
-l : Limits the used bandwidth
1. Remote server ----> Local machine (at local terminal)
scp [options] [user_name]@[remote_ip]:[remote_dir or file] [local_dir]
----> Download ****** Directory ******* (option -r)
Remote_server's directory 'try' → Local directory /home/
예시) scp -r -P 1111 seonghoon@111.111.111.111:/home/
----> Download ****** File ******
Remote_server's file 'file1.txt' → Local directory /home/
예시) scp -P 포트숫자 1111 seonghoon@111.111.111.111:/home/seonghoon/try/file1.txt /home/
2. Local machine ----> Remote server (at local terminal)
scp [options] [Local_dir or file] [user_name]@[remote_ip]:[remote_dir]
3. Remote server ----> Remote server (at local terminal)
scp [options] [user_name]@[remote_ip]:[remote_dir or file] [user_name]@[remote_ip]:[remote_dir]
##############################################################################
tmux
여러개의 모델을 돌릴때 용이. 로컬 컴퓨터와 연결이 끊어져도 서버에서 계속 돌아감.
tmux
# Create a new tmux session
tmux
# list created tmux id
tmux ls
# open specific tmux session by session id
tmux attach -t id_num
e.g.
tmux attach -t 0
tmux attach -t 1
# exit from a tmux session while keep the session running
1st step: ctrl + b
2nd step: d
# kill tmux session
tmux kill-session -t session id
e.g., tmux kill-session -t 2
# kill all tmux sessions at onces
tmux kill-server
# Start scrolling -> End scrolling
ctrl+b [ -> ctrl+c
# Creating Named Tmux Sessions
$ tmux new -s session_name
##############################################################################
Ubuntu Server / Desktop nvidia driver installation
엔비디아 드라이버 이슈가 사람을 미치게 한다.
# Ubuntu Server nvidia driver installation
$ sudo apt-get update -y --fix-missing; sudo apt-get dist-upgrade -y --fix-missing; sudo apt-get remove -y nvidia-*; sudo apt-get autoremove -y; sudo ubuntu-drivers devices
$ sudo apt-get install -y nvidia-driver-<recommended nvidia driver from the previous command result>
e.g., $ sudo apt-get install -y nvidia-driver-440
$ sudo reboot now
# Ubuntu Desktop nvidia driver installation (For Ubuntu Desktop, nvidia-440 is not available so that we need to use nvidia-430 instead so far. [updated on 20200520])
$ sudo apt update -y --fix-missing; sudo apt full-upgrade -y --fix-missing; sudo apt remove -y nvidia-*; sudo apt autoremove -y; sudo apt install -y nvidia-430; sudo reboot now
##############################################################################
Linux PATH(environment)
환경변수 설정을 잘해두자 (라이브러리 다운받고 환경변수 설정안하는 멍청한짓은..)
echo $PATH : Disply the path
export PATH="$PATH:/home/seonghoon/"
: ADD the PATH but it's disapear when rebooting
vi ~/.bashrc : ADD export PATH="$PATH:~" for using after rebooting
source .bashrc : Using modified bashrc PATH
##############################################################################
X11 forwarding
서버에 들어갈때 포워딩 안하면 안보임..
When you want to open image file from remote server at local monitor
-> X11 forwarding https://blog.naver.com/n_cloudplatform/221451046295
>>> ssh -X -p 7722 seonghoon@165.194.104.215
Display image
서버에 저장된 이미지를 내 컴퓨터 화면에 띄우고 싶을때.
Imagemagic
>>> sudo apt-get update && sudo apt-get install imagemagick
>>> display file.jpg
feh
>>> sudo apt install feh
>>> feh file.jpg
dicomscope
>>> sudo apt install dicomscope
>>> dicomscope
##############################################################################
Terminal shortcut
그대는 마우스없이 코딩을 할 수 있는가?
리눅스 터미널에서 마우스는 필요가 없다..
Ctrl + Alt + T : Open terminal
Ctrl + Shift + C : Copy on terminal
Ctrl + Shift + v : Paste on terminal
Ctrl + A : Move cursor to the front
Ctrl + E : Move cursor to the end
Ctrl + U : Delete all letters from cursor left side
Ctrl + K : Delete all letters from cursor right side
Ctrl + W : Delete one word from cursor left side
Ctrl + C : Dismiss current process
Ctrl + D : Close terminal
Ctrl + L : Clear the terminal
Ctrl + Z : Move From current process to background terminal
Ctrl + R + [text] : Find the statement start form text(search)
-> Ctrl + R : Find next statement
Shift + PageUP : Move befor page
F11 : Full screen
~ : Home folder symbol
##############################################################################
Terminal File Commands
아주 기본중에 기본...
윈도우에 익숙한 사람은 폴더를 클릭해야 직성이 풀리죠..
ls : directory listing
ls -a : show all files
ls -l : show details(permission, group, size..) of files
ls -s : show files sorted by size(or -lS)
ls -t : show files sorted by times
ls -r : show files sorted by reverse order(originally alphabet)
ls -R : show all directory list(include under directory)
ls -h : show data that human can read(K,M,G)
ls -lu : show the atime(접근시간)
ls -lc : show the ctime(변경시간)
ls > file.txt : we can save directory lists in file.txt
------> we can compose these options at once like this
ls -alSrh
: show all files that reversed order by file size and written in K,M,G
------> we can choose the directory like this
ls -al /home/
: show all files that in /home/ directory
------> we can choose files by name
ls *.txt
: show the files of which name is ended by .txt
df : check hard drive status(-h option : human read)
cd dir : change directory to dir
cd : change to home
cd .. : change to it's parents directory
pwd : show current directory
mkdir dir : create directory dir
mkdir -p dir1/dir2 (-p, --parents option)
: make directory with parents directory
mkdir -pv dir2/dir2 (-v, --verbose option)
: show the detail of process
mkdir -m 700 dir: we can give the rights
tree : show the directory tree(sudo apt install tree)
rm file : delete file
rm -r dir : delete directory dir
rm -f file : force remove file
rm -rf dir : force remove directory dir*
cp file_1 file_2: copy file_1 to file_2
cp f1 f2 home/ : copy f1 & f2 to the home/ directory
cp -r dir/ home/: copy the whole dir directory to home directory(-r option)
cp -r dir/ backup$(date '+_%Y%m%d')
: backup the directory by date
touch file : create(empty file) or update(time stamp) file
stat file : check file's time stamp & details
cat file : Standard output device (show the file, can be multiple files)
cat > file : Make new file. After over writing text, Save file (Ctrl + D)
cat >> file : Append text on the file, Save file (Ctrl + D)
cat f1 > f2 : Copy the file f1 to file f2
cat f1 f2 > f12 : Concatenate f1, f2 and make new f12 file(if there's no f12)
Overwrite f12 file(if there's already f12)
cat f1 f2 >> f12: Append f1 f2 to f12(if there's already f12)
cat option -n : Show line number option
mv file1 file2 : change the file name
mv file1 dir1/ : move file1 to dir1 directory
mv dir1/ dir2/ : change the directory name (from dir1 to dir2)
##############################################################################
Terminal Process Management
리눅스에서는 ctrl + alt + Delete 하지 마세요...
ps : display your currently active processes
top : display all running processes
htop : display all running processes
##############################################################################
Terminal File Permissions
나만 보고 싶은 비밀 폴더가 있다면...(내용물이 뭘지 궁금하군..)
id : check the uid, gid, groups..
d : directory
l : link file
8-bit expression
r : read (4)
w : write (2)
x : execute(1)
---------- : Total 10 symbols
d--------- : First d(directory) or l(linkfile) -(file)
-rwx------ : Next three symbols(2~4) are owner(user)'s permission
----rwx--- : Next three symbols(5~7) are groups's permission
-------rwx : Next three symbols(8~10)are other's permission
file ------> can have only read & write (total number 6)
directory --> can have all read & write & execute (total number 7)
so we can give permission to each category with numbers
chmod 777 dir1/ : give all permission(r,w,x) to users, groups, others
------> drwxrwxrwx
chmod 666 file : give all permission(r,w) to users, groups, others
------> -rw-rw-rw-
chmod 600 t1.txt: give all permission(r,w) to only users
------> -rw-------
chmod 644 t1.txt: give r,w to users, read to groups & others
------> -rw-r--r--
##############################################################################
Linux Shortcuts(Normal & Browser)
리얼 잡다 단축키.. 업어도 죽진않지만 알고있으면 꽤 요긴하죠..
PrtSc : Full screen shot
Alt + PrtSc : Screen shot the window
Shift + PrtSc : Screen shot what we choose
Ctrl + A : Select all
Ctrl + B : Book-mark side bar (firefox)
Ctrl + D : Book-mark (firefox)
Ctrl + H : Visit Record (firefox)
Ctrl + L : Move to Link typing (firefox)
Ctrl + N : New window
Ctrl + O : Open the file
Ctrl + Q : Quit all windows (Alt + F4)
Ctrl + R : Refresh the web browser (F5)
Ctrl + T : Open New tab on web browser
Ctrl + W : Close now window or tab
Ctrl + Tab : Move next tab on browser
Ctrl + Shift + O : Book-mark edit
Ctrl + Shift + B : show Book-mark bar on browser(firefox)
Ctrl + Click : Open the Link on new tab
Shift + Click : Open the Link on new window
Ctrl + Z : Undo
Ctrl + Shift + Z : Redo
F : Full screen(video)
Alt + F4 : Close the window
Alt + F7 : Move the window's location
Alt + F8 : Change the window size
Alt + F10 : Full window size
Alt + number : Move to n'th browser tab
Alt + left : backward page
Alt + right : forward page
Super + D : Move to Back ground
Change window shortcuts
Alt + Tab : change the window
Ctrl + Alt + up/down : change the workspace
Super-L(left window key): menu
Alt + Esc : change the window without effect
Ctrl + Alt + Delete : Log-out
'소프트웨어자료 > 리눅스' 카테고리의 다른 글
Illegal instruction (core dumped) 에러 해결 (0) | 2022.09.21 |
---|---|
[Linux/리눅스] sudo 권한 (0) | 2021.12.22 |
[ 아나콘다 ] 업데이트, 업그레이드 하기 (update, upgrade) (0) | 2021.08.10 |
[ 아나콘다 ] env 생성, 삭제, 활성화, 비활성화 (create, remove, activate, deactivate) (1) | 2021.08.10 |
[ Linux/Ubuntu ] tar 링크자료 (0) | 2021.05.14 |