- 리눅스 원하는 크기 파일 생성
- 리눅스 원하는 크기 파일 만들기
1 방법 1: fallocate
Bash
Copy
fallocate -l 크기 파일명
- 실행예시 (100바이트)
bat
Copy
[root@jmnote test]# fallocate -l 100 test.txt
[root@jmnote test]# ll test.txt
-rw-r--r--. 1 root root 100 Feb 5 08:37 test.txt
- 실행예시 (10GB)
bat
Copy
[root@jmnote test]# fallocate -l 10G test.txt
[root@jmnote test]# ll -h test.txt
-rw-r--r--. 1 root root 10G Feb 5 08:37 test.txt
2 방법 2: dd
Bash
Copy
dd if=/dev/zero of=파일명 count=변수1 bs=변수2
- → 변수1 × 변수2 바이트의 파일이 생성됨
- 실행예시 (1000 바이트)
bat
Copy
[root@jmnote test]# dd if=/dev/zero of=text.txt count=1000 bs=1
1000+0 records in
1000+0 records out
1000 bytes (1.0 kB) copied, 0.00432457 s, 231 kB/s
- 실행예시 (100000 바이트)
bat
Copy
[root@jmnote test]# dd if=/dev/zero of=text.txt count=1000 bs=100
1000+0 records in
1000+0 records out
100000 bytes (100 kB) copied, 0.00480996 s, 20.8 MB/s
3 같이 보기
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.
- 분류 댓글:
- 리눅스 (19)
CentOS JDK 설치 ― …CentOS JDK 설치 ― ElliottCentOS vsftpd 설치 및 설정 ― …CentOS에서 apt-get 실행해보기 ― …CentOS에서 apt-get 실행해보기 ― 다미안VirtualBox 리눅스 인터넷 연결 ― …VirtualBox 리눅스 인터넷 연결 ― JmnoteVirtualBox 리눅스 인터넷 연결 ― …리눅스 CPU 사용률 확인 ― 동원잉리눅스 JDK 버전 확인 ― …리눅스 JDK 버전 확인 ― Jmnote리눅스 SSH 패스워드 없이 자동 로그인 ― …리눅스 SSH 패스워드 없이 자동 로그인 ― Jmnote리눅스 날짜 기준으로 파일 삭제하기 ― 백승현리눅스 날짜 기준으로 파일 삭제하기 ― Jmnote리눅스 디렉토리 용량 확인 du ― …리눅스 메모리 사용률 확인 ― 최재완리눅스 메모리 사용률 확인 ― Jmnote좀비 프로세스 찾기, 죽이기 ― 불량펭귄