'3-1. Linux/::Command::'에 해당되는 글 21건
- 2011/01/28 메일 발송 스크립트
- 2011/01/28 [BASH] 어제날짜를 구하고싶다, 지난달 날짜를 구하고 싶다
- 2011/01/28 [BASH] 문자열
- 2011/01/04 yum group install
- 2010/02/25 free
- 2009/12/02 리눅스에 있는 기본 명령어 소스
- 2009/09/09 ISO 파일 마운트 하기
- 2009/08/13 리눅스 서버의 종료 및 재시작
- 2009/03/30 binary 파일 뷰어
- 2009/03/23 리눅스에서 파일명 일괄 변경하기.
1. 패턴으로 문자열 자르기
1.1. 패턴에서 6번째 값 추출(/etc/passwd에서 홈 디렉토리 추출)
# grep coriahn /etc/passwd | awk -F :
'{print $6}'
Awk을 이용해서 “:”를 구분자로 6번째 필드를 출력
1.2. 패턴에서 마지막 값 추출(패스에서 마지막 패스 추출)
# echo ${PATH##*:}
“:”를 구분자로 마지막값 출력 ##의 의미는 일단 미지수
1.3. 패턴에서 마지막 값 잘라내기(파일명에서 확장자 제거)
# path=back.sh
# echo ${path%.*}
back
“.”을 구분자로
하여 마지막 패턴을 삭제하는듯…
2. –추가사항은 나중에..
BASH: Split a string without ‘cut’ or ‘awk’
Posted by AntonAPR10
For a little test script I’m writing I needed to split a line on a ‘;’ but preservere the “s and ‘s, something that echo doesn’t like to do. Digging deeper into the bash docs I see that there are some handy string handling functions.
#!/bin/bash
line=’this “is” a command;this “is” a pattern’
COMMAND=${line%;*}
PATTERN=${line#*;}
echo $COMMAND
echo $PATTERN
And the output would be:
this “is” a command
this “is” a pattern
이 기능을 이용하면 미리 설정된 패키지들을 손쉽게 설치할 수 있도록 해준다.
1. 그룹 목록 확인
[root@localhost ~]# yum grouplist
Loaded plugins: fastestmirror
Setting up Group Process
Loading mirror speeds from cached hostfile
* addons: data.nicehosting.co.kr
* base: data.nicehosting.co.kr
* extras: data.nicehosting.co.kr
* updates: data.nicehosting.co.kr
Installed Groups:
Administration Tools
DNS Name Server
Dialup Networking Support
Editors
FTP Server
GNOME Desktop Environment
Games and Entertainment
Graphical Internet
Graphics
Java
Legacy Network Server
Mail Server
MySQL Database
Network Servers
News Server
Office/Productivity
Printing Support
Server Configuration Tools
Sound and Video
System Tools
Text-based Internet
Web Server
Windows File Server
X Window System
Yum Utilities
Available Groups:
Authoring and Publishing
Base
Beagle
Cluster Storage
Clustering
Development Libraries
Development Tools
Emacs
Engineering and Scientific
FreeNX and NX
GNOME Software Development
Horde
Java Development
KDE (K Desktop Environment)
KDE Software Development
KVM
Legacy Software Development
Legacy Software Support
Mono
OpenFabrics Enterprise Distribution
PostgreSQL Database
Ruby
Tomboy
Virtualization
X Software Development
XFCE-4.4
Done
2.1 또 다른 방법
# yum install @cluster-storage @clustering
위 명령은 동일한 명령을 수행한다.
| total |
used | free | shared | buffers | cached | |
| Mem: | 2022 | 1420 | 602 | 0 |
64 |
1137 |
| -/+ buffers/cache: | 218 | 1804 |
||||
| Swap: | 1983 | 0 |
1983 | |||
| Total: |
4006 | 1420 | 2586 | |||
mem의 total : 물리적 메모리의 값(2G)
used : 물리적 메모리의 사용량
free : 물리적 메모리의 남은량
shared : ??
buffers : 버퍼영역으로 할당된 메모리
cached : 케시영역으로 할당된 메모리
-/+ buffers/cache의 used : 버퍼와 케시영역을 제외한 실질적인 사용량
free : 버퍼와 케시영역을 포함한 실질적인 메모리의 남은량(mem의 free, buffers, cached 의 값을 더한값)
여기서 파일 받은 다음에 압축풀고..
find로 write 검색 해보세요..
write.c라는 파일이 있네요..
참 좋은 현상이죠...
깔끔하게 명령어 한줄로 마운트 시키기.. 굿입니다 아주 굿이에요..# mount -o loop -t iso9660 -r /home/test.iso /mnt/iso
영화를 보다가 잘때 꼭 유용한 명령어다.. ㅋㅋㅋㅋ
- shutdown을 이용한 시스템 종료 및 재시작
# /sbin/shutdown [-t sec] [-rkhncfF] time [warning-messages]
-k : 실제로 종료하지 않고 모든 사용자에게 경고 메시지만을 보냅니다.
-r : 시스템 종료후에 재부팅을 합니다.(reboot)
-h : 시스템을 종료하며 재부팅을 하지 않습니다.(halt)
-f : 재부팅할 때 파일시스템체ㅡ를 (fsck: file system check)를 하지 않습니다.
-c : 이전에 내렸던 shutdown명령을 취소합니다.
time : 몇분 후에 시스템을 종료할 것인가를 지정합니다.
warning-messages : 사용자에게 보내질 종료 메시지.
# shutdown -h 5 "system rebooting..." -> "system rebooting..." 메시를 뿌리면서 현재부터 5분 후에 시스템을 종료
# shutdown -c -> shutdown 종료명령 취소
# shutdown -r +5 "system rebooting..." -> 5분 후에 시스템을 재시작
# shutdown -r now -> 시스템을 즉시 재부팅
# shutdown -h now -> 시스템을 즉시 종료
- reboot(= shutdown -r now)으로 서버 재시작하기
- poweroff로 서버 종료하기
- halt(= shutdown -h now)로 서버 종료하기
- init을 원하는 실행레벨로 서버 종료 및 재시작
펌'd by 민군넷
xxd 명령어는 리눅스 shell상에서 binary파일(이진파일)의 hexdump를 보여주는 명령어이다.
기본 사용법은
xxd [option] filename
과 같다.
버전에 따라 약간의 차이는 있지만 option 동작은 다음과 같다.
|
-b : dump가 이진법(즉, 0과1)로 출력됨. -c 갯수 : 행(line)당 출력되는 열(column)의 갯수 설정. -g 갯수 : 출력시 group으로 묶이는 byte의 갯수를 설정. -l 길이 : 설정된 길이 byte 만큼만 출력됨 -p 또는 -ps : 주소나 ASCII없이 hexdump 내용만 출력됨. -u : hex를 소문자 대신 대문자로 출력. -s [+][-]위치 : 설정된 위치에서 부터 hexdump함. 위치 또는 +위치는 파일의 시작부터의 위치를 나타내고, -위치는 파일의 끝에서 부터의 위치를 나타냄. -i : C언어에서 사용할수 있는 형식으로 출력. -r : 반대로 hexdump를 binary 파일로 바꾸어 준다. |
rename 's/.txt$/.doc/' *
NAME
rename - renames multiple files
SYNOPSIS
rename [ -v ] [ -n ] [ -f ] perlexpr [ files ]
DESCRIPTION
"rename" renames the filenames supplied according to the rule specified as the first
argument. The perlexpr argument is a Perl expression which is expected to modify the
$_ string in Perl for at least some of the filenames specified. If a given filename
is not modified by the expression, it will not be renamed. If no filenames are given
on the command line, filenames will be read via standard input.
For example, to rename all files matching "*.bak" to strip the extension, you might
say
rename 's/\.bak$//' *.bak
To translate uppercase names to lower, you'd use
rename 'y/A-Z/a-z/' *
OPTIONS
-v, --verbose
Verbose: print names of files successfully renamed.
-n, --no-act
No Action: show what files would have been renamed.
-f, --force
Force: overwrite existing files.
ENVIRONMENT
No environment variables are used.
AUTHOR
Larry Wall
SEE ALSO
