网站搜索

基本 Linux 面试问题与解答 - 第二部分


继续访谈系列,我们在本文中提出10个问题。这些问题以及未来文章中的问题并不一定意味着在任何采访中都会被问到。我们通过此类帖子为您提供一个互动学习平台,这肯定会有所帮助。

根据本系列上一篇文章《Linux基础面试题11道》在不同论坛上的评论分析,这里有必要提一下,为了给我们的读者带来一篇高质量的文章。我们付出时间和金钱,我们对您的期望是什么?没有什么。如果您不能赞扬我们的工作,请不要因为您的负面评论而使我们士气低落。

如果您在帖子中没有发现任何新内容,请不要忘记这对某人有帮助,并且他/她对此表示感谢。我们不可能在每篇文章中都让每个人都满意。希望各位读者能够理解这一点。

Q.1:哪个命令用于将用户登录会话记录在文件中?
  1. 脚本
  2. 记录
  3. 会话记录

让我们使用脚本命令记录用户的登录会话,如图所示。

[root@tecmint ~]# script my-session-record.txt

Script started, file is my-session-record.txt

日志文件“my-session-record.txt”的内容可以查看为:

[root@tecmint ~]# nano my-session-record.txt

script started on Friday 22 November 2013 08:19:01 PM IST
[root@tecmint ~]# ls
^[[0m^[[01;34mBinary^[[0m ^[[01;34mDocuments^[[0m ^[[01;34mMusic^[[0m $
^[[01;34mDesktop^[[0m ^[[01;34mDownloads^[[0m my-session-record.txt ^[[01;34$
Q.2:可以使用以下哪个命令查看内核日志消息?
  1. 消息
  2. 核心
  3. LS-i
  4. 乌纳梅
  5. 以上都不是
[root@tecmint ~]# dmesg

Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Linux version 2.6.32-279.el6.i686 ([email ) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Fri Jun 22 10:59:55 UTC 2012
KERNEL supported cpus:
  Intel GenuineIntel
  AMD AuthenticAMD
  NSC Geode by NSC
  Cyrix CyrixInstead
  Centaur CentaurHauls
  Transmeta GenuineTMx86
  Transmeta TransmetaCPU
  UMC UMC UMC UMC
Disabled fast string operations
BIOS-provided physical RAM map:
...
Q.3:哪个命令用来显示Linux内核的版本?
  1. uname -v
  2. uname -r
  3. uname-m
  4. 名称 -n
  5. uname -o
[root@tecmint ~]# uname -r

2.6.32-279.el6.i686
Q.4:用什么命令来识别文件类型?
  1. 类型
  2. 信息
  3. 文件
  4. 哪个
  5. LS
[root@tecmint ~]# file wtop

wtop: POSIX shell script text executable
Q.5:哪个命令可以定位命令的二进制文件、源代码和手册页?
[root@tecmint ~]# whereis /usr/bin/ftp

ftp: /usr/bin/ftp /usr/share/man/man1/ftp.1.gz
Q.6:当用户登录时,默认情况下会调用哪些文件来存储用户配置文件?
[root@tecmint ~]# ls -al
-rw-r--r--.  1 tecmint     tecmint            176 May 11  2012 .bash_profile
-rw-r--r--.  1 tecmint     tecmint            124 May 11  2012 .bashrc
Q.7:‘resolv.conf’文件是一个配置文件?
[root@tecmint ~]# cat /etc/resolv.conf

nameserver 172.16.16.94
Q.8: 哪个命令用于创建文件的软链接?
  1. ln-s
  2. 关联
  3. 软链接
  4. 以上都不是
[root@tecmint ~]# ln -s /etc/httpd/conf/httpd.conf httpd.original.conf
Q.9: 命令‘pwd’是 Linux 中命令‘passwd’的别名?
[root@tecmint ~]# pwd

/home/tecmint
[root@tecmint ~]# passwd
Changing password for user root.
New password:
Retype new password:
问题 10:如何在 Linux 上检查 pci 设备供应商和版本?
[root@tecmint ~]# lspci

00:00.0 Host bridge: Intel Corporation 5000P Chipset Memory Controller Hub (rev b1)
00:02.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 2-3 (rev b1)
00:04.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 4-5 (rev b1)
00:06.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 6-7 (rev b1)
00:08.0 System peripheral: Intel Corporation 5000 Series Chipset DMA Engine (rev b1)
...

目前为止就这样了。我希望以上这些问题对您有很大帮助。在下周末,我们再次提出了一些新的问题。在那之前保持健康,调整并连接到Tecmint