라벨이 Linux인 게시물 표시

리눅스 파일 검색: find 명령어 활용법

이미지
서론 "100개의 파일이 있는 폴더에서 특정 확장자를 가진 파일을 모두 찾으려면 어떻게 해야 할까요? 리눅스에서 이 문제를 해결하기 위해 find 명령어를 사용하면 됩니다. 오늘은 find 명령어의 강력한 기능과 사용법에 대해 알아보겠습니다." 본론 find 명령어 소개 find 명령어는 리눅스에서 파일을 검색하는 데 사용되는 강력한 도구입니다. 이 명령어를 사용하면 특정 디렉토리에서 파일 이름, 파일 유형, 수정 시간 등을 기준으로 파일을 검색할 수 있습니다. 기본 사용법 find 명령어의 기본 구문은 다음과 같습니다. 1 find [검색할 디렉토리] [검색 조건] [실행할 작업] cs 예제 특정 디렉토리에서 모든 파일 찾기 1 find /path/to/directory cs 특정 확장자를 가진 파일 찾기 1 find /path/to/directory -name "*.txt" cs 이 명령어는 /path/to/directory 디렉토리에서 .txt 확장자를 가진 모든 파일을 찾습니다. 특정 크기 이상의 파일 찾기 1 find /path/to/directory -size +100M cs 이 명령어는 100MB 이상의 파일을 찾습니다. 특정 시간 이후에 수정된 파일 찾기 1 find /path/to/directory -mtime -7 cs 이 명령어는 지난 7일 이내에 수정된 파일을 찾습니다. 찾은 파일 삭제하기 1 find  / path / to / directory  - name  "*.log"   - exec  rm  - f {} \; cs 이 명령어는 .log 파일을 찾고, 찾은 파일들을 삭제합니다. 고급 사용법 find 명령어는 다양한 조건과 옵션을 결합하여 매우 세부적인 검색을 수행할 수 있습니다. AND 조건 사용하기 1 find /path/to/directory -name "*.txt" -a -size +1M cs 이 명령어는 1MB 이상의 .txt 파일을 찾습니다. OR 조건

Monitoring system resources with htop - from installation to usage

이미지
System monitoring with htop (ubuntu based) htop is a terminal-based program that allows you to easily and quickly check the resource usage of your system, such as CPU, memory, swap, processes, etc. It is similar to the task manager in Windows, but it provides more diverse and detailed information, and you can manage processes with keyboard shortcuts. In this post, I will show you how to install and use htop on ubuntu. Installing htop To install htop on ubuntu, you need to first open the terminal and update and upgrade your system. This is an essential step to maintain the stability and compatibility of your system. Please enter the following command. 1 sudo apt update  & &  sudo apt upgrade cs After updating and upgrading your system, you can install htop with the following command. 1 sudo apt install htop cs When the installation is complete, you can run htop by typing htop in the terminal. Using htop When you run htop, you will see a screen like this. The top of the screen sh

How to control disk usage with Quota

What is Quota? Explanation of the basic settings and usage methods Quota is a feature that limits the number or capacity of files that a user or group can have.  For example, if you want to limit the usage of a user named B to 100GB on a file system named A, you can use Quota. Quota allows you to manage disk space efficiently and prevent disk waste by users or groups. Types of Quota There are two types of Quota. User Quota: Quota that limits disk usage by user. It is also called usrquota. Group Quota: Quota that limits disk usage by group. It is also called grpquota. To apply Quota, the file system must support Quota and the Quota option must be added to the fstab file. Terms of Quota When setting or checking Quota, you need to know the following terms. Block: The block unit of the disk. Usually calculated as 1KB. Inode: A structure that stores the metadata of a file. It represents the number of files. Soft Limit: The limit that gives a warning. If this limit is exceeded, a grace perio

Various examples and tips for using the watch command in Linux

What is the Linux watch command? The Linux watch command is a useful tool that repeatedly displays the result of a specific command at regular intervals. For example, you can use it to monitor the system’s CPU and memory usage, detect changes in files, or check the network connection status. The basic format of the watch command is as follows. 1 watch [options] [command] cs There are various options, but the most commonly used ones are as follows. -n : Specifies the update interval in seconds. The default value is 2 seconds. -d : Highlights the parts that have changed compared to the previous result. -t : Does not display the time at the top. -c : Keeps the color. Examples of using the watch command Let’s look at some examples of how to use the watch command. 1. Monitoring system CPU and memory usage If you want to monitor the system’s CPU and memory usage, you can use the watch command with the top command. For example, if you enter the following, it will update the result of the top

How to set up crontab and check if it works

What is crontab? crontab is a command that allows you to schedule periodic tasks on Linux. For example, you can use crontab to automate tasks such as backing up every night, deleting logs every Monday, or checking system status every hour. crontab can be divided into two types: System-wide crontab: Tasks defined in the /etc/crontab file that are shared by all users. Individual user’s crontab: Tasks that each user creates and manages with the crontab command that only the user can access. In this post, we will learn about the individual user’s crontab and how to set it up and check if it works. How to set up crontab The crontab command has the following options: -e: Edit the crontab file. By default, the vi editor opens, but you can use a different editor by setting the EDITOR environment variable. -l: Print the contents of the current crontab file. -r: Delete the current crontab file. To edit the crontab file, enter the following command: 1 $ crontab -e cs Then you can define tasks in

Ubuntu에서 GitLab 사용하기: 설치부터 기본 설정까지

이미지
GitLab은 오픈 소스로 개발된 협업 플랫폼으로, 코드 관리, 이슈 추적, CI/CD 등의 기능을 제공합니다. GitLab은 자체 서버에 설치할 수도 있고, 클라우드 서비스를 이용할 수도 있습니다. 이번 포스팅에서는 Ubuntu에 GitLab을 설치하고 기본적인 설정을 하는 방법에 대해 알아보겠습니다. GitLab 설치하기 GitLab을 설치하기 전에, 우선 Ubuntu 시스템을 업데이트하고 필요한 패키지들을 설치해야 합니다. 터미널에서 다음 명령어들을 순서대로 실행합니다. 1 2 3 sudo apt update sudo apt upgrade sudo apt install  - y curl openssh - server ca - certificates tzdata cs 그 다음, GitLab 패키지 저장소를 추가하고 GitLab 패키지를 설치합니다. 다음 명령어들을 순서대로 실행합니다. 1 2 curl https: / / packages.gitlab.com / install / repositories / gitlab / gitlab - ee / script.deb.sh  |  sudo bash sudo EXTERNAL_URL = "http://your_domain_or_ip_address"  apt install gitlab - ee cs 여기서 EXTERNAL_URL은 GitLab에 접속할 때 사용할 도메인 이름이나 IP 주소입니다. 예를 들어, http://gitlab.example.com이나 http://192.168.0.10과 같이 입력하면 됩니다. GitLab 패키지를 설치하면 자동으로 GitLab 서비스가 시작됩니다. 웹 브라우저에서 위에서 설정한 EXTERNAL_URL로 접속하면 GitLab의 초기 설정 화면이 나타납니다. 설치에 성공하면 확인할 수 있는 GitLab 초기 화면 GitLab 설정하기 GitLab의 초기 설정 화면에서는 관리자 계정의 비밀번호를 설정해야 합니다. 원하는 비밀번호를 입력하고 Change your pa