Merge pull request #559 from hyaocuk/master

[翻译完成] 'Basic Linux Interview Questions and Answers – Part II'
This commit is contained in:
Xingyu.Wang 2013-12-12 05:24:17 -08:00
commit e1e099ac6c
2 changed files with 164 additions and 166 deletions

View File

@ -1,166 +0,0 @@
hyaocuk is TRANSLATING
Basic Linux Interview Questions and Answers Part II
================================================================================
Continuing the Interview Series, we are giving 10 Questions here, in this article. These questions and the questions in the future articles doesnt necessarily means they were asked in any interview. We are presenting you an interactive learning platform through these kind of posts, which surely will be helpful.
![](http://www.tecmint.com/wp-content/uploads/2013/11/Basic-Interview-Questions-2.png)
Upon the analysis of comments in different forums on last article [11 Basic Linux Interview Questions][1] of this series, it is important to mention here that to bring up a quality article to our readers. We give our time and money, and in return what we expect from you? Nothing. If you cant praise our work, please dont demoralize us from your negative comments.
If you find nothing new in a post, dont forget that for someone it was helpful, and for that he/she was thankful. We cant make everyone happy in each of our article. Hope you readers would take pain to understand this.
### Q.1: Which command is used to record a user login session in a file? ###
- macro
- read
- script
- record
- sessionrecord
> **Answer** : The script command is used to record a users login session in a file. Script command can be implemented in a shell script or can directly be used in terminal. Here is an example which records everything between script and exit.
Lets record the users login session with script command as shown.
[root@tecmint ~]# script my-session-record.txt
Script started, file is my-session-record.txt
The content of log file my-session-record.txt can be views as:
[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: The kernel log message can be viewed using which of the following command? ###
- dmesg
- kernel
- ls -i
- uname
- None of the above
> **Answer** : The kernel log message can be viewed by executing 'dmesg' command. In the list kernel is not a valid Linux command, 'ls -i' lists the file with inode within the working directory and 'uname' command shows os.
[root@tecmint ~]# dmesg
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Linux version 2.6.32-279.el6.i686 (mockbuild@c6b9.bsys.dev.centos.org) (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: Which command is used to display the release of Linux Kernel? ###
- uname -v
- uname -r
- uname -m
- uname -n
- uname -o
> **Answer** : The command uname -r display the kernel release information. The switch -v , -m , -n , o display kernel version, machine hardware name, network node, hostname and operating system, respectively.
[root@tecmint ~]# uname -r
2.6.32-279.el6.i686
### Q.4: Which command is used to identify the types of file? ###
- type
- info
- file
- which
- ls
> **Answer** : The file command is used to identify the types of file. The syntax is file [option] File_name.
[root@tecmint ~]# file wtop
wtop: POSIX shell script text executable
### Q.5: Which command locate the binary, source and man page of a command? ###
> **Answer** : The whereis command comes to rescue here. The whereis command locate the binary, source, and manual page files for a command.
[root@tecmint ~]# whereis /usr/bin/ftp
ftp: /usr/bin/ftp /usr/share/man/man1/ftp.1.gz
### Q.6: When a user login, which files are called for user profile, by default?? ###
> **Answer** : The .profile and .bashrc present under home directory are called for user profile by default.
[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: The resolve.conf file is a configuration file for?
> **Answer** : The /etc/resolve.conf is the configuration file for DNS at client side.
[root@tecmint ~]# cat /etc/resolv.conf
nameserver 172.16.16.94
### Q.8: Which command is used to create soft link of a file? ###
- ln
- ln -s
- link
- link -soft
- None of the above
> **Answer** : The ln -s command is used to create soft link of a file in Linux Environment.
[root@tecmint ~]# ln -s /etc/httpd/conf/httpd.conf httpd.original.conf
### Q.9: The command pwd is an alias of command passwd in Linux? ###
> **Answer** : No! The command pwd is not an alias of command passwd by default. pwd stands for print working directory, which shows current directory and passwd is used to change the password of user account in Linux.
[root@tecmint ~]# pwd
/home/tecmint
[root@tecmint ~]# passwd
Changing password for user root.
New password:
Retype new password:
### Q.10: How will you check pci devices vendor and version on a Linux? ###
> **Answer** : The Linux command lspci comes to rescue here.
[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)
...
Thats all for now. I hope these above questions might be very helpful to you. In our next weekend we again come-up with some new set of questions. Till then stay healthy, tuned and connected to Tecmint.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/basic-linux-interview-questions-and-answers-part-ii/
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.tecmint.com/basic-linux-interview-questions-and-answers/

View File

@ -0,0 +1,164 @@
基本的 Linux 面试问题和答案 - 第二部分
================================================================================
继续我们这面试系列在这篇文章里我们给出了10个问题。这些问题或者是在以后的文章中出现的问题不一定在面试中会被问到。然而通过这些文章我们呈现出的是一个交互的学习平台这必将会对你有很大的帮助。
![](http://www.tecmint.com/wp-content/uploads/2013/11/Basic-Interview-Questions-2.png)
自本系列的上一篇文章[11个基本的 Linux 面试问题][1],我们分析了不同论坛对此作出的评论,我们不得不提的是我们很有必要提供优质的文章给我们的读者。我们付出了时间和金钱,那我们又渴望从你们身上得到什么回报呢?答案是没有的。如果你不能赞扬我们的工作,但恳请不要在评论中败坏我们的工作。
如果你在文章中没有找到什么新的东西,但也请不要忘记它对某些人却是非常有用的,并且他或她会非常感激我们的工作。我们不能够让每一篇文章都使大家高兴。但我希望读者们能够尽量理解。
### 问题1哪一条命令把用户登录会话记录在文件中 ###
- macro
- read
- script
- record
- sessionrecord
> **答案**script 命令是用来把用户登录的会话信息记录在文件里。这条命令能够用在 shell 脚本里面有或者直接在终端中使用。下面是一个例子,它记录了开始用 script 到输入 exit 结束之间的所有东西。
Lets record the users login session with script command as shown.
[root@tecmint ~]# script my-session-record.txt
Script started, file is my-session-record.txt
The content of log file my-session-record.txt can be views as:
[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$
### 问题2以下那一条命令可以用来查看内核日志信息 ###
- dmesg
- kernel
- ls -i
- uname
- None of the above
> **答案**:执行 'dmesg' 命令可以查看内核的日志信息。在上面的命令中kernel 不是一个有效的命令,'ls -i' 是用来列出工作目录中文件的索引节点,而 'uname' 是用来显示操作系统。
[root@tecmint ~]# dmesg
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Linux version 2.6.32-279.el6.i686 (mockbuild@c6b9.bsys.dev.centos.org) (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:
...
### 问题3哪一条命令是用来显示 Linux 内核发行信息的? ###
- uname -v
- uname -r
- uname -m
- uname -n
- uname -o
> **答案**uname -r是用来显示内核的发行信息。其它参数-v-m-no分别显示内核版本、机器硬件名称、网络节点、主机名和操作系统。
[root@tecmint ~]# uname -r
2.6.32-279.el6.i686
### 问题4那一条命令是被用来识别文件类型的 ###
- type
- info
- file
- which
- ls
> **答案**file命令是用来识别文件类型的。其语法是file [选项] 文件名’。
[root@tecmint ~]# file wtop
wtop: POSIX shell script text executable
### 问题5哪一条命令是被用来找一条命令的二进制文件、源和手册的所在的路径 ###
> **答案**whereis驾到whereis命令是用来找一条命令的二进制文件、源和手册的所在的路径。
[root@tecmint ~]# whereis /usr/bin/ftp
ftp: /usr/bin/ftp /usr/share/man/man1/ftp.1.gz
### 问题6当用户登录时默认情况下哪些文件会被调用作为用户资料 ###
> **答案**:在用户的目录下‘.profile.bashrc会默认地被调用作为用户资料。
[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
### 问题7resolve.conf文件是什么的配置文件 ###
> **答案**/etc/resolve.conf 是 DNS 客户端的配置文件。
[root@tecmint ~]# cat /etc/resolv.conf
nameserver 172.16.16.94
### 问题8哪一条命令是用来创建一个文件的软链接的 ###
- ln
- ln -s
- link
- link -soft
- None of the above
> **答案**:在 Linux 环境下ls -s是被用来创建一个文件的软链接的。
[root@tecmint ~]# ln -s /etc/httpd/conf/httpd.conf httpd.original.conf
### 问题9pwd命令是passwd命令的别名吗 ###
> **答案**不是默认情况下pwd命令不是passwd命令的别名。pwdprint working directory的缩写也就是输出当前的工作目录passwd在 Linux 中是被用来更改用户的帐号密码。
[root@tecmint ~]# pwd
/home/tecmint
[root@tecmint ~]# passwd
Changing password for user root.
New password:
Retype new password:
### 问题10在 Linux 中,你会怎样检测 pci 设备的厂商和版本。 ###
> **答案**:我们用的 Linux 命令是lspci
[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 保持联系喔!
--------------------------------------------------------------------------------
via: http://www.tecmint.com/basic-linux-interview-questions-and-answers-part-ii/
译者:[hyaocuk](https://github.com/hyaocuk) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.tecmint.com/basic-linux-interview-questions-and-answers/