'정리중 > 리눅스' 카테고리의 다른 글

vim 단축키  (0) 2014.07.03
vim 설치 & 초기화  (0) 2014.07.03
리눅스 명령어 정리  (0) 2014.07.03
,ma 맨페이지 보기>>

* 창나누기 ctrl+w+v / ctrl +w+n

* 쉘 명령어 사용 ! [명령]  / r! [명령]

* ctrl + w +q 현재커서창삭제
* ctrl + w +c 현재커서창삭제
* ctrl + w+ o 현재창만 남기고 다 삭제


Vim명령어 모음

 입력 명령어
 a 커서에 위치 다음 칸 부터 입력 A 커서에 행의 맨 마지막부터 입력
 i 커서에 위치에서 입력 I 커서에 맨 앞에서부터 입력
 o 커서에 다음 행에서 입력 O 커서에 이전 행에서 입력
 s 커서에 위치한 한 글자를 지우고 입력 cc 커서에 위치의 한 행을 지우고 입력
 저장 & 종료 & 불러오기
 w 저장 w file.txt file.txt 로 저장
 w >> file.txt file.txt 파일에 덧붙여 저장 zz Vim 저장하고 종료
 q! Vim 강제로 종료 q Vim 종료
 wq! Vim 강제로 저장하고 강제종료 wq Vim 저장하고 종료
 e file.txt file.txt 파일 불러오기 e 현재 파일 불러오기
 Vim 이전에 작업한 프로젝트로 들어가기
 복사 & 붙여넣기& 삭제
 yy 현재 커서에 있는 행 복사 p 붙여넣기
 [?]yy 커서가 있는 행 부터 ? 까지 복사 [?]p ?번 만큼 붙여넣기
 x, dl 커서에 위치한 글자 삭제 X, dh 커서 앞에 글자 삭제
 dw 한 단어를 삭제 d0 커서의 위치부터 행의 처음까지 삭제
 D, d$ 커서 위치부터 행 끝까지 삭제 dd 커서가 위치한 행 삭제
 dj 커서가 있는 행과 그 다음 행을 삭제 dk 커서가 있는 행과 그 앞의 행을 삭제


'정리중 > 리눅스' 카테고리의 다른 글

프로세스 종료 중단 단축키  (0) 2014.07.03
vim 설치 & 초기화  (0) 2014.07.03
리눅스 명령어 정리  (0) 2014.07.03


/etc/vim/vimrc 설정하기


set nocompatible " 오리지날 VI와 호환하지 않음

set autoindent  " 자동 들여쓰기

set cindent " C 프로그래밍용 자동 들여쓰기

set smartindent " 스마트한 들여쓰기

set wrap 

set nowrapscan " 검색할 때 문서의 끝에서 처음으로 안돌아감

set nobackup " 백업 파일을 안만듬

set visualbell " 키를 잘못눌렀을 때 화면 프레시

set ruler " 화면 우측 하단에 현재 커서의 위치(줄,칸) 표시

set shiftwidth=4 " 자동 들여쓰기 4칸

set number " 행번호 표시, set nu 도 가능

set fencs=ucs-bom,utf-8,euc-kr.latin1 " 한글 파일은 euc-kr로, 유니코드는 유니코드로

set fileencoding=utf-8 " 파일저장인코딩 

set tenc=utf-8      " 터미널 인코딩

set expandtab " 탭대신 스페이스

set hlsearch " 검색어 강조, set hls 도 가능

set ignorecase " 검색시 대소문자 무시, set ic 도 가능

set tabstop=4 "  탭을 4칸으로

set lbr

set incsearch "  키워드 입력시 점진적 검색

syntax on "  구문강조 사용

filetype indent on "  파일 종류에 따른 구문강조

set background=dark " 하이라이팅 lihgt / dark

colorscheme desert  "  vi 색상 테마 설정

set backspace=eol,start,indent "  줄의 끝, 시작, 들여쓰기에서 백스페이스시 이전줄로

set history=1000 "  vi 편집기록 기억갯수 .viminfo에 기록



'정리중 > 리눅스' 카테고리의 다른 글

프로세스 종료 중단 단축키  (0) 2014.07.03
vim 단축키  (0) 2014.07.03
리눅스 명령어 정리  (0) 2014.07.03

http://linoxide.com/guide/linux-command-shelf.html

1. SYSTEM
2. HARDWARE
3. STATISTICS
4. USERS
5. FILE COMMANDS
6. PROCESS RELATED
7. FILE PERMISSION RELATED
8. NETWORK
9. COMPRESSION / ARCHIVES
10. INSTALL PACKAGE
11. SEARCH
12. LOGIN (SSH AND TELNET)
13. FILE TRANSFER
14. DISK USAGE
15. DIRECTORY TRAVERSE
1. SYSTEM

$ uname –a => Display linux system information
$ uname –r => Display kernel release information (refer uname command in detail)
$ cat /etc/redhat_release => Show which version of redhat installed
$ uptime => Show how long system running + load (learn uptime command)
$ hostname => Show system host name
$ hostname -i => Display the IP address of the host (all options hostname)
$ last reboot => Show system reboot history (more examples last command)
$ date => Show the current date and time (options of date command)
$ cal => Show this month calendar (what more in cal)
$ w => Display who is online (learn more about w command)
$ whoami => Who you are logged in as (example + sreenshots)
$ finger user => Display information about user (many options of finger command)
2. HARDWARE

$ dmesg => Detected hardware and boot messages (dmesg many more options)
$ cat /proc/cpuinfo => CPU model
$ cat /proc/meminfo => Hardware memory
$ cat /proc/interrupts => Lists the number of interrupts per CPU per I/O device
$ lshw => Displays information on hardware configuration of the system
$ lsblk => Displays block device related information in Linux (sudo yum install util-linux-ng)
$ free -m => Used and free memory (-m for MB) (free command in detail)
$ lspci -tv => Show PCI devices (very useful to find vendor ids)
$ lsusb -tv => Show USB devices (read more lsusb options)
$ lshal => Show a list of all devices with their properties
$ dmidecode => Show hardware info from the BIOS (vendor details)
$ hdparm -i /dev/sda # Show info about disk sda
$ hdparm -tT /dev/sda # Do a read speed test on disk sda
$ badblocks -s /dev/sda # Test for unreadable blocks on disk sda
3. STATISTICS

$ top => Display and update the top cpu processes (30 example options)
$ mpstat 1 => Display processors related statistics (learn mpstat command)
$ vmstat 2 => Display virtual memory statistics (very useful performance tool)
$ iostat 2 => Display I/O statistics (2sec Intervals) (more examples)
$ tail -n 500 /var/log/messages => Last 10 kernel/syslog messages (everyday use tail options)
$ tcpdump -i eth1 => Capture all packets flows on interface eth1 (useful to sort network issue)
$ tcpdump -i eth0 'port 80' => Monitor all traffic on port 80 ( HTTP )
$ lsof => List all open files belonging to all active processes.(sysadmin favorite command)
$ lsof -u testuser => List files opened by specific user
$ free –m => Show amount of RAM (daily usage command)
$ watch df –h => Watch changeable data continuously(interesting linux command)

4. USERS

$ id => Show the active user id with login and group(with screenshot)
$ last => Show last logins on the system (few more examples)
$ who => Show who is logged on the system(real user who logged in)
$ groupadd admin => Add group "admin" (force add existing group)
$ useradd -c "Sam Tomshi" -g admin -m sam => Create user "sam" and add to group "admin"(here read all parameter)
$ userdel sam => Delete user sam (force,file removal)
$ adduser sam => Add user "sam"
$ usermod => Modify user information(mostly useful for linux system admins)

5. FILE COMMANDS

$ ls –al => Display all information about files/ directories(20 examples)
$ pwd => Show current directory path(simple but need every day)
$ mkdir directory-name => Create a directory(create mutiple directory)
$ rm file-name => Delete file(be careful of using rm command)
$ rm -r directory-name => Delete directory recursively
$ rm -f file-name => Forcefully remove file
$ rm -rf directory-name => Forcefully remove directory recursively
$ cp file1 file2 => Copy file1 to file2 (15 cd command examples)
$ cp -r dir1 dir2 => Copy dir1 to dir2, create dir2 if it doesn’t exist
$ mv file1 file2 => Move files from one place to another(with 10 examples)
$ ln –s /path/to/file-name link-name => Create symbolic link to file-name (examples)
$ touch file => Create or update file (timestamp change)
$ cat > file => Place standard input into file (15 cat command examples)
$ more file => Output the contents of file (help display long tail files)
$ head file => Output the first 10 lines of file (with different parameters)
$ tail file => Output the last 10 lines of file (detailed article with tail options)
$ tail -f file => Output the contents of file as it grows starting with the last 10 lines
$ gpg -c file => Encrypt file (how to use gpg)
$ gpg file.gpg => Decrypt file

6. PROCESS RELATED

$ ps # Display your currently active processes (many parameters to learn)
$ ps aux | grep 'telnet' # Find all process id related to telnet process
$ pmap # Memory map of process (kernel,user memory etc)
$ top # Display all running processes (30 examples)
$ kill pid # Kill process with mentioned pid id (types of signals)
$ killall proc # Kill all processes named proc
$ pkill processname # Send signal to a process with its name
$ bg # Resumes suspended jobs without bringing them to foreground (bg and fg command)
$ fg # Brings the most recent job to foreground
$ fg n # Brings job n to the foreground

7. FILE PERMISSION RELATED

$ chmod octal file-name # Change the permissions of file to octal , which can be found separately for user, group and world
octal value (more examples)
4 - read
2 – write
1 – execute
Example
$ chmod 777 /data/test.c # Set rwx permission for owner , rwx permission for group, rwx permission for world
$ chmod 755 /data/test.c # Set rwx permission for owner,rx for group and world
$ chown owner-user file # Change owner of the file (chown more examples)
$ chown owner-user:owner-group file-name # Change owner and group owner of the file
$ chown owner-user:owner-group directory # Change owner and group owner of the directory
Example
$ chown bobbin:linoxide test.txt
$ ls -l test.txt
-rw-r--r-- 1 bobbin linoxide 0 Mar 04 08:56 test.txt
8. NETWORK

$ ifconfig –a # Display all network ports and ip address (set mtu and other all options,ifconfig now in deprecated network command)
$ ifconfig eth0 # Display specific ethernet port ip address and details
$ ip addr show # Display all network interfaces and ip address(available in iproute2 package,powerful than ifconfig)
$ ip address add 192.168.0.1 dev eth0 # Set ip address
$ ethtool eth0 # Linux tool to show ethernet status (set full duplex , pause parameter)
$ mii-tool eth0 # Linux tool to show ethernet status (more or like ethtool)
$ ping host # Send echo request to test connection (learn sing enhanced ping tool)
$ whois domain # Get who is information for domain
$ dig domain # Get DNS information for domain (screenshots with other available parameters)
$ dig -x host # Reverse lookup host
$ host google.com # Lookup DNS ip address for the name (8 examples of host command)
$ hostname –i # Lookup local ip address (set hostname too)
$ wget file # Download file (very useful other option)
$ netstat -tupl # Listing all active listening ports(tcp,udp,pid) (13 examples)

9. COMPRESSION / ARCHIVES

$ tar cf home.tar home # Create tar named home.tar containing home/ (11 tar examples)
$ tar xf file.tar # Extract the files from file.tar
$ tar czf file.tar.gz files # Create a tar with gzip compression
$ gzip file # Compress file and renames it to file.gz (untar gzip file)

10. INSTALL PACKAGE

$ rpm -i pkgname.rpm # Install rpm based package (Installing, Uninstalling, Updating, Querying ,Verifying)
$ rpm -e pkgname # Remove package
Install from source
./configure
make
make install (what it is)

11. SEARCH

$ grep pattern files # Search for pattern in files (you will this command often)
$ grep -r pattern dir # Search recursively for pattern in dir
$ locate file # Find all instances of file
$ find /home/tom -name 'index*' # Find files names that start with "index"(10 find examples)
$ find /home -size +10000k # Find files larger than 10000k in /home

12. LOGIN (SSH AND TELNET)

$ ssh user@host # Connect to host as user (secure data communication command)
$ ssh -p port user@host # Connect to host using specific port
$ telnet host # Connect to the system using telnet port

13. FILE TRANSFER

scp
$ scp file.txt server2:/tmp # Secure copy file.txt to remote host /tmp folder
$ scp nixsavy@server2:/www/*.html /www/tmp # Copy *.html files from remote host to current system /www/tmp folder
$ scp -r nixsavy@server2:/www /www/tmp # Copy all files and folders recursively from remote server to the current system /www/tmp folder
rsync
$ rsync -a /home/apps /backup/ # Synchronize source to destination
$ rsync -avz /home/apps linoxide@192.168.10.1:/backup # Synchronize files/directories between the local and remote system with compression enabled

14. DISK USAGE

$ df –h # Show free space on mounted filesystems(commonly used command)
$ df -i # Show free inodes on mounted filesystems
$ fdisk -l # Show disks partitions sizes and types(fdisk command output)
$ du -ah # Display disk usage in human readable form (command variations)
$ du -sh # Display total disk usage on the current directory
$ findmnt # Displays target mount point for all filesystem (refer type,list,evaluate output)
$ mount device-path mount-point # Mount a device
15. DIRECTORY TRAVERSE

$ cd .. # To go up one level of the directory tree(simple & most needed)
$ cd # Go to $HOME directory
$ cd /test # Change to /test directory
- See more at: http://linoxide.com/guide/linux-command-shelf.html#sthash.yRQXvNC2.dpuf

'정리중 > 리눅스' 카테고리의 다른 글

프로세스 종료 중단 단축키  (0) 2014.07.03
vim 단축키  (0) 2014.07.03
vim 설치 & 초기화  (0) 2014.07.03

+ Recent posts