WorksheetsCâu hỏi về Linux_2
Total questions: 30
Worksheet time: 23mins
Tập tin nào chứa thông tin về các nhóm người dùng trong Linux?
/etc/passwd
/etc/group
/etc/shadow
/etc/gshadow
Để thay đổi quyền sở hữu nhóm của file myfile thành group "dev" lệnh nào?
chown :dev myfile
chgrp dev myfile
chmod g+dev myfile
usermod -g dev myfile
Lệnh nào để tìm tất cả file có đuôi .txt trong thư mục hiện tại và các thư mục con?
find . -name "*.txt"
ls -R *.txt
grep .txt
locate *.txt
Trong Apache (httpd) file cấu hình chính thường nằm ở đâu trên CentOS/RHEL?
/etc/httpd/conf/httpd.conf
/etc/apache2/apache2.conf
/var/www/html/conf
/usr/local/apache/conf
Để khởi động lại dịch vụ Apache trên systemd lệnh nào?
service apache restart
systemctl restart httpd
apachectl restart
/etc/init.d/httpd restart
Lệnh nào để xem dung lượng đĩa đã sử dụng?
df -h
du -sh
free -h
ls -lh
Trong bash script dòng đầu tiên thường là gì?
#!/bin/bash
#!/usr/bin/python
echo "Start"
set -x
Để thêm user "devuser" với shell /bin/bash và home /home/devuser lệnh nào?
useradd -m -s /bin/bash devuser
adduser devuser
usermod -s /bin/bash devuser
mkdir /home/devuser
Lệnh nào để xóa user "olduser" và thư mục home của họ?
userdel -r olduser
rm -rf /home/olduser
deluser olduser
usermod -L olduser
Port mặc định của SSH là bao nhiêu?
21
22
80
443
Để thay đổi port SSH sang 2222 ta chỉnh sửa file nào?
/etc/ssh/sshd_config
/etc/ssh/ssh_config
/etc/services
/etc/hosts.allow
Lệnh nào để xem kernel version đang chạy?
uname -r
cat /proc/version
kernel --version
lsmod
Trong mã nguồn mở giấy phép GPL yêu cầu gì chính?
Phải công bố source code nếu phân phối binary
Không được sửa đổi
Phải trả phí
Chỉ dùng cho cá nhân
Lệnh nào dùng để xem thông tin phiên bản của distribution Linux đang chạy?
cat /etc/os-release
lsb_release -a
uname -a
Tất cả đều đúng tùy distro
Để cài gói "vim" trên Ubuntu/Debian lệnh nào?
apt install vim
yum install vim
dnf install vim
rpm -i vim
Trên CentOS/RHEL 8+ lệnh cài gói là gì?
dnf install vim
apt-get install vim
pacman -S vim
emerge vim
Lệnh nào để xem các package đã cài?
Trên CentOS/RHEL 8+ lệnh cài gói là gì?
dnf install vim
apt-get install vim
pacman -S vim
emerge vim
Lệnh nào để xem các package đã cài?
dpkg -l (Debian) hoặc rpm -qa (RPM)
ls /usr/bin
yum list
apt show
Để tìm file có tên chứa "config" trong toàn hệ thống?
find / -name "config" 2>/dev/null
locate config
grep config /
ls -R | grep config
Lệnh nào để kill tiến trình có PID 1234?
kill 1234
kill -9 1234
pkill 1234
Tất cả đều đúng tùy trường hợp
Trong vi lệnh nào để tìm kiếm từ "bug" và đi tiếp?
/bug
?bug
n
:set hlsearch
Tập tin nào lưu trữ mật khẩu đã mã hóa của người dùng trong Linux?
/etc/passwd
/etc/shadow
/etc/group
/etc/gshadow
Lệnh chmod 644 myfile tương đương với quyền nào?
rw-r--r--
rwxr-xr-x
rwx------
rwxrwx---
Để mount thiết bị USB /dev/sdb1 vào thư mục /mnt/usb lệnh nào đúng?
mount /dev/sdb1 /mnt/usb
mount -t usb /dev/sdb1 /mnt/usb
umount /dev/sdb1
fdisk /dev/sdb1
Lệnh nào dùng để tìm kiếm recursive chuỗi "error" trong tất cả file dưới /var/log?
grep -r "error" /var/log
find /var/log -grep error
cat /var/log | grep error
ls /var/log | grep error
Trong file cấu hình Apache httpd.conf khối nào dùng để định nghĩa máy chủ ảo?
Lệnh nào để xem tất cả các alias đã định nghĩa trong shell hiện tại?
alias
unalias
export
set
Để lập lịch chạy lệnh "backup.sh" mỗi ngày lúc 2:00 AM dùng crontab nào?
0 2 * * * /path/backup.sh
* 2 0 * * /path/backup.sh
2 0 * * * /path/backup.sh
0 * 2 * * /path/backup.sh
Lệnh sed nào để thay thế "old" bằng "new" trong file data.txt?
sed 's/old/new/g' data.txt
sed -i 'old/new' data.txt
sed 'replace old new' data.txt
sed 's/old/new' data.txt
