Sum up - Linux Interview Questions (Updating)

本文详细解答了Linux Shell面试中常见的几个问题,包括文件查找、正则表达式验证电话号码、压缩文件操作、系统事件跟踪、远程系统管理及文本搜索等核心技能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Linux / Shell  interview questions

 

1.    Write a command that will look for files with anextension “c”, and has the occurrence of the string “apple” in it.

Find ./ -name “*.c” | xargs grep –i “apple”

2.    Xargs 代替一堆parameters,就是把之前的参数都在这次传进来,比如你想rm一堆你你find到的文件,likethis:rm`find /path -type f`。但是这样会报错,参数太多,所以需要改成这样find/path -type f -print0 | xargs -0 rm。记住:单纯的”|”是不管用的,因为是rm sth而不是sth->命令,所以”|”没用。

3.    Valid Phone Number:

cat file.txt | grep -E "^(([0-9]{3})|[0-9]{3}-)[0-9]{3}-[0-9]{4}$"

4.    Let’s say you maintains a backup on regularbasis for the company you are working. The backups are maintained in Compressedfile format. You need to examine a log, two months old. What would you suggestwithout decompressing the compressed file?

5.  # zcat ­f phpshell­2.4.tar.gz

 

6.    You need to track events on your system. Whatwill you do?

Running ‘syslogd‘ application in terminalgenerates log file at the location ‘/var/log/syslog‘. The syslogd applicationis very useful in troubleshooting Linux sytems. A sample log file looks similarto below.

 

7.    Telnet and SSH both are communication protocolwhich are used to manage remote system. SSH is Secured, which requiresexchanging of key opposite of telnet which transmit data in plain text, whichmeans telnet is less secure than SSH.

8.     You need to search for the string “Tecmint” in allthe “.txt” files in the current directory. How will you do it?

9.  # find -­name “*.txt” | xargs grep “Tecmint”


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值