How do I read a text file using awk pattern scanning and text processing language under Linux / Unix like operating systems?
ow do I count lines if given word or string matches for each input file under Linux or UNIX-like operating systems?
Q. How do I reverse lines of a file under Linux / UNIX bash shell?
A. You need to use the rev utility or command. It copies the specified files to the standard output, reversing the order of characters in every line. If no files are specified, the standard input is read.
Display one line
tail -1 /etc/passwd
Reverse one line
$ tail -1 /etc/passwd | rev
Q. How do I change DNS search order in Linux? In order to improve performance I need to make changes.
A. Under Linux you need to use /etc/nsswitch.conf file which is used by system databases and Name Service Switch configuration file
Various functions in the C Library need to be configured to work correctly in the local environment. Tradition ally, this was done by using files (e.g., ‘/etc/passwd’), but other nameservices (like the Network Information Service (NIS) and the Domain Name Service (DNS)) became popular, and were hacked into the C library, usually with a fixed search order.
Step # 1: /etc/nsswitch.conf
Open /etc/nsswitch.conf file using text editor:
# vi /etc/nsswitch.conf
Look for hosts:
hosts: files dns mdns4
Set above order as per your requirement. Close and save the file.
host.conf – resolver configuration file
The file /etc/host.conf contains configuration information specific to the resolver library. It should contain one configuration keyword per line, followed by appropriate configuration information.
Open /etc/host.conf file
# vi /etc/host.conf
Find order line which specifies how host lookups are to be performed. It should be followed by one or more lookup methods, separated by commas. Valid methods are bind (dns server), hosts (/etc/hosts file), and nis (old method).
Save and close the file.
See the nsswitch.conf and host.conf man pages for details.
ow do I Move or migrate user accounts to from old Linux server a new Cent OS Linux server including mails? This new system a fresh installation.
an you explain /etc/passwd
file format for Linux and Unix-like operating systems?
Q. Can you tell us what defines a user account under Linux operating system?