diff --git a/sources/10 Useful Random Linux Interview Questions and Answers.md b/sources/10 Useful Random Linux Interview Questions and Answers.md new file mode 100644 index 0000000000..c86f3e4791 --- /dev/null +++ b/sources/10 Useful Random Linux Interview Questions and Answers.md @@ -0,0 +1,89 @@ +10 Useful Random Linux Interview Questions and Answers +================================================================================ +To a little surprise this time we are not presenting Interview question on any specific subject but on random topics. These question will surely help you in cracking Interviews beside adding to your Knowledge. + +![](http://www.tecmint.com/wp-content/uploads/2014/02/Random-Interview-Questions.png) + +1. Let’s say you maintains a backup on regular basis for the company you are working. The backups are maintained in Compressed file format. You need to examine a log, two months old. What would you suggest without decompressing the compressed file? + +> **Answer** : To check the contents of a compressed file without the need of decompressing it, we need to use ‘zcat’. The zcat utility makes it possible to view the contents of a compressed file. + + # zcat ­f phpshell­2.4.tar.gz + +2. You need to track events on your system. What will you do? + +> **Answer** : For tracking the events on the system, we need a daemon called syslogd. The syslogd daemon is useful in tracking the information of system and then saving it to specified log files. + +Running ‘**syslogd**‘ application in terminal generates log file at the location ‘/var/log/syslog‘. The syslogd application is very useful in troubleshooting Linux sytems. A sample log file looks similar to below. + +![syslongd](http://www.tecmint.com/wp-content/uploads/2014/02/syslongd.jpg) + +3. How will you restrict IP so that the restricted IP’s may not use the FTP Server? + +> **Answer** : We can block suspicious IP by integrating tcp_wrapper. We need to enable the parameter “tcp_wrapper=YES” in the configuration file at ‘/etc/vsftpd.conf’. And then add the suspicious IP in the ‘host.deny’ file at location ‘/etc/host.deny’. + +#### Block IP Address #### + +Open ‘/etc/hosts.deny’ file. + + # vi /etc/hosts.deny + +Add the IP address that you want to block at the bottom of the file. + + # + # hosts.deny This file contains access rules which are used to + # deny connections to network services that either use + # the tcp_wrappers library or that have been + # started through a tcp_wrappers-enabled xinetd. + # + # The rules in this file can also be set up in + # /etc/hosts.allow with a 'deny' option instead. + # + # See 'man 5 hosts_options' and 'man 5 hosts_access' + # for information on rule syntax. + # See 'man tcpd' for information on tcp_wrappers + # + vsftpd:172.16.16.1 +4. Tell us the difference between Telnet and SSH? + +> **Answer** : Telnet and SSH both are communication protocol which are used to manage remote system. SSH is Secured, which requires exchanging of key opposite of telnet which transmit data in plain text, which means telnet is less secure than SSH. + +5. You need to stop your X server. When you tries to kill your X server, You got an error message that you cannot quit X server. What will you do? + +> **Answer** : When killing a X server, it won’t work normal way like doing ‘/etc/init.d/gdm stop’. We need to execute a special key combination ‘Ctrl+ Alt+ Back Space’ which will force X server to restart. + +6. What is the difference between command ‘ping’ and ‘ping6′? + +> **Answer** : Both the commands are same and used for the same purpose except that the fact that ping6 is used with ipv6 IP address. + +7. You want to search for all the *.tar files in your Home directory and wants to delete all at once. How will you do it? + +> **Answer** : We need to use find command with rm command to delete all “.tar” files. + + # find /home/ ­name '*.tar' | xargs rm ­rf + +8. What is the difference between locate and slocate command? + +> **Answer** : The slocate looks for the files that user have access whereas locate will search for the file with updated result. + +9. You need to search for the string “Tecmint” in all the “.txt” files in the current directory. How will you do it? + +> **Answer** : We need to run the fine command to search for the text “Tecmint” in the current directory, recursively. + + # find ­name “*.txt” | xargs grep “Tecmint” + +10. You want to send a message to all connected users as “Server is going down for maintenance”, what will you do? + +> **Answer** : This can be achieved using the wall command. The wall command sends a message to all connected users on the sever. + + # echo please save your work, immediately. The server is going down for Maintenance at 12:30 Pm, sharply. | wall + +![wall command](http://www.tecmint.com/wp-content/uploads/2014/02/wall.jpg) + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/useful-random-linux-interview-questions-and-answers/ + +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 \ No newline at end of file diff --git a/sources/5 Command Line Tools for Downloading Files/Torrents and Browsing Websites.md b/sources/5 Command Line Tools for Downloading Files/Torrents and Browsing Websites.md new file mode 100644 index 0000000000..8cf7303d42 --- /dev/null +++ b/sources/5 Command Line Tools for Downloading Files/Torrents and Browsing Websites.md @@ -0,0 +1,134 @@ +5 Command Line Tools for Downloading Files/Torrents and Browsing Websites +================================================================================ +Linux command-line, the most adventurous and fascinating part of GNU/Linux is very cool and powerful tool. Command line itself is very productive and the availability of various inbuilt and third party command line application makes Linux robust and powerful. The Linux Shell supports a variety of web application of various kind be it torrent downloader, dedicated downloader or Internet Surfing. + +![5 Command Line Internet Tools](http://www.tecmint.com/wp-content/uploads/2014/02/Command-Line-Internet-Tools.jpg) + +Here we are presenting **5 great command line Internet tools**, which are very useful and proves to be very handy. + +### 1. rTorrent ### + +rTorrent is a text­-based Torrent Client which is written in C++ aimed at high performance. It is available for most of the standard Linux Distributions including FreeBSD and Mac OS X. + +#### Installation of rTorrent #### + + # apt­-get install rtorrent (on APT based System) + + # yum install rtorrent (on YUM based System) + +Check if rtorrent is installed correctly by running the following command in the terminal. + + # rtorrent + +![rTorrent Command Line Tool](http://www.tecmint.com/wp-content/uploads/2014/02/rTorrent.jpeg) + +#### Functioning of rTorrent #### + +Some of the useful Key-bindings and their use. + +- **CTRL+ q** – Quit rTorrent Application +- **CTRL+ s** – Start Download +- **CTRL+ d** – Stop an active Download or Remove an already stopped Download. +- **CTRL+ k** – Stop and Close an active Download. +- **CTRL+ r** – Hash Check a torrent before Upload/Download Begins. +- **CTRL+ q** – When this key combination is executed twice, rTorrent shutdown without sending a stop Signal. +- **Left Arrow Key** – Redirect to Previous screen. +- **Right Arrow Key** – Redirect to Next Screen + +### 2. Wget ### + +**Wget**, is a part of GNU Project, the name is derived from World Wide Web (**WWW**). Wget is a brilliant tool which is useful for recursive download, offline viewing of **HTML** from local Server and is available for most of the platforms be it **Windows, Mac, Linux**. Wget makes it possible to download files over **HTTP, HTTPS** and **FTP**. Moreover it can be useful in mirroring the whole website as well as support for proxy browsing, pausing/resuming Downloads. + +#### Installation of Wget #### + +**Wget** being a GNU project comes bundled with Most of the Standard Linux Distributions and there is no need to download and install it separately. If in-case, it’s not installed by default, you can still install it using **apt** or **yum**. + + # apt­-get install wget (on APT based System) + + # yum install wget (on YUM based System) + +#### Some Basic Usage of Wget #### + +Download a single file using wget. + + # wget http://www.website-name.com/file + +Download a whole website, recursively. + + # wget -r http://www.website-name.com + +Download specific type of file (say pdf and png) from a website. + + # wget -r -A png,pdf http://www.website-name.com + +Wget is a wonderful tool which enables custom and filtered download even on limited resource Machine. A screen shot of wget download, where we are mirroring a website (**Yahoo.com**). + +![Wget Command Line File Download](http://www.tecmint.com/wp-content/uploads/2014/02/Wget.jpeg) + +For more such wget download examples, read our article that shows [10 Wget Download Command Examples][1]. + +### 3. cURL ### + +**cURL** is a command line tool for transferring data over a number of protocols. cURL is a client side application which support protocols like **FTP, HTTP, FTPS, TFTP, TELNET, IMAP, POP3,** etc. cURL is a simple downloader which is different from wget in supporting **LDAP, POP3** as compared to others. Moreover Proxy Downloading, pausing download, resuming download are well supported in cURL. + +#### Installation of cURL #### + +By default cURL is available in most of the distribution either in repository or installed. if it’s not installed, just do a **apt** or **yum** to get a required package from the repository. + + # apt­-get install curl (on APT based System) + + # yum install curl (on YUM based System) + +#### Basic Usage of cURL #### + + # curl www.tecmint.com + +![Curl Data Download](http://www.tecmint.com/wp-content/uploads/2014/02/Curl.jpeg) + +![Curl Download](http://www.tecmint.com/wp-content/uploads/2014/02/Curl-2.jpeg) + +### 4. w3m ### + +The w3m is a text based web browser released under GPL. W3m support tables, frames, color, SSL connection and inline images. W3m is known for fast browsing. + +#### Installation of w3m #### + +Again w3m is available by default in most of the Linux Distribution. If incase, it is not available you can always **apt** or **yum** the required package. + + # apt­-get install w3m (on APT based System) + + # yum install w3m (on YUM based System) + +#### Basic Usage of w3m #### + + # w3m www.tecmint.com + +![w3m Text Based Web Browser](http://www.tecmint.com/wp-content/uploads/2014/02/w3m.jpeg) + +### 5. Elinks ### + +**Elinks** is a free text-based web browser for Unix and Unix based System. Elinks support **HTTP**, **HTTP Cookies** and also support browsing script in **Perl** and **Ruby**. Tab based browsing is well supported. The best thing is that it supports Mouse, Display Colours and support a number of Protocols like **HTTP, FTP, SMB, Ipv4** and **Ipv6**. + +#### Installation of Elinks #### + +By default elinks also available in most of the Linux distributions. If not, install it via **apt** or **yum**. + + # apt­-get install elinks (on APT based System) + + # yum install elinks (on YUM based System) + +#### Basic Usage of Elinks #### + +# elinks www.tecmint.com + +![Elinks Command Line Web Browsing](http://www.tecmint.com/wp-content/uploads/2014/02/Elinks.jpeg) + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/command-line-tools-for-downloading-file-and-browsing-websites/ + +译者:[译者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/10-wget-command-examples-in-linux/ \ No newline at end of file diff --git a/sources/Accessing Clipboard Contents Across Multiple Instances of Vim from Terminal.md b/sources/Accessing Clipboard Contents Across Multiple Instances of Vim from Terminal.md new file mode 100644 index 0000000000..70d2a44ab2 --- /dev/null +++ b/sources/Accessing Clipboard Contents Across Multiple Instances of Vim from Terminal.md @@ -0,0 +1,103 @@ +Accessing Clipboard Contents Across Multiple Instances of Vim from Terminal +================================================================================ +**Vim (Vi IMproved)** is one of the most favourite text editors among programmers. It has its own specialities in performing different operations with short hand commands. + +![Accessing Clipboard Contents from Vim](http://www.tecmint.com/wp-content/uploads/2014/02/vim-clipboard-content.jpeg) + +For example, to copy the highlighted text we use the ‘**y**‘ command and ‘x‘ to cut the same. But, by default **vim** (and not **gVim**) clipboard contents cannot be accessed after closing vim instances. + +Vim uses the ‘**+**‘ register to refer to the system clipboard. You can run ‘**vim ­­–version**‘ and if you cannot see something like “**+xterm_clipboard**” and instead “­**xterm_clipboard**“, then internal clipboard contents will not be available outside **vim**. + +### Install gvim and parcellite ### + +In order to access the vim clipboard contents, you need to install **gvim** package. The **gVim** is a GUI mode for vim editor where clipboard option is enabled by default. + + # yum install -y gvim + +Next, enable [RPMForge Repository][1] to install **parcellite** package. The Parcellite is a lightweight, tiny and free clipboard manager for Linux. + + # yum install -y parcellite + +Once installed, run the following command. Where argument ‘**&**’ is used to send parcellite for running as a background process. + + # parcellite & + +Check whether the option is enabled in gvim. + + # gvim --version + +Make sure you have the “**+xterm_clipboard**” option displayed in the output as shown below. + + VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Apr 5 2012 10:12:08) + Included patches: 1-411 + Modified by + Compiled by + Huge version with GTK2 GUI. Features included (+) or not (-): + +arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent + +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments + +cryptv +cscope +cursorshape +dialog_con_gui +diff +digraphs +dnd -ebcdic + +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path + +float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand + +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap + +menu +mksession +modify_fname +mouse +mouseshape +mouse_dec +mouse_gpm + -mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte + +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra +perl +postscript + +printer +profile +python +quickfix +reltime +rightleft -ruby +scrollbind + +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax + +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse + +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual + +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup + +X11 -xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save + +Open up user’s .bashrc file. + + # vim ~/.bashrc + +And add the alias and save the file (press ‘**i**’ to insert line and press **ESC**, then run **:wq** to save and exit). + + # .bashrc + + # User specific aliases and functions + + alias rm='rm -i' + alias cp='cp -i' + alias mv='mv -i' + alias vim='gvim -v' + # Source global definitions + if [ -f /etc/bashrc ]; then + . /etc/bashrc + fi + +This alias is a built-in used to bypass some command to another. Thus every time when vim command is issued, the corresponding alias goes to gvim with clipboard enabled by default. + +Now edit your ‘**.vimrc**‘ file in a similar way (In case if you don’t have a **.vimrc** file, generate one such file through and then get back here. + + # vim ~/.vimrc + +Append the following line and save the file. + + autocmd VimLeave * call system("echo -n $'" . escape(getreg(), "'") . "' | xsel -ib") + +Now open any file in vim and highlight the portion of text (using ‘v‘ command) and press “+y. Try to paste anywhere outside vim (after closing or without closing vim) and you are done. + +### Generating .vimrc File ### + +Run the following command to generate **.vimrc** file (skip this part if you already have one). + + # cd [This will put you in home directory] + # vim .vimrc + +In vim run the following after pressing the ESC key (In vim every command is run after pressing ESC key which puts you in command mode). + + :r $VIMRUNTIME/vimrc_example.vim + :w + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/accessing-clipboard-contents-across-multiple-instances-of-vim-from-terminal/ + +译者:[译者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/install-and-enable-rpmforge-repository-in-rhel-centos-6-5-4/ \ No newline at end of file