How to take down/up a network interface in Linux?
Answer:
To take the eth0 interface (the first network card) down:
# sudo ifconfig eth0 down
To take the eth0 interface up:
# sudo ifconfig eth0 up
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to take down/up a network interface in Linux?
Answer:
To take the eth0 interface (the first network card) down:
# sudo ifconfig eth0 down
To take the eth0 interface up:
# sudo ifconfig eth0 up
Vertical (\G) output of query result in MySQL client
Answer:
Sometimes, a query returning too much columns will make the query output not very readable in the MySQL client.
You can use the \G, instead of ; when executing the query, so the vertical output is shown.
mysql> show variables like '%thread%' \G
*************************** 1. row ***************************
Variable_name: max_delayed_threads
Value: 20
*************************** 2. row ***************************
Variable_name: max_insert_delayed_threads
Value: 20
*************************** 3. row ***************************
Variable_name: myisam_repair_threads
Value: 1
*************************** 4. row ***************************
Variable_name: pseudo_thread_id
Value: 169
*************************** 5. row ***************************
Variable_name: thread_cache_size
Value: 12
*************************** 6. row ***************************
Variable_name: thread_handling
Value: one-thread-per-connection
*************************** 7. row ***************************
Variable_name: thread_stack
Value: 262144
7 rows in set (0.00 sec)
Find duplicated records in MySQL
Answer:
Assume you have a table `my_table` which contains a column called "name", how do you find what name has been duplicated in your table?
SELECT name, COUNT(`name`) as cnt
FROM `my_table`
GROUP BY `name`
HAVING cnt > 1
That's all.
Quickly clear the screen
Answer:
Previously we discussed how to clear the screen using the clear command. But the most easy way is to type Ctrl+l key in your terminal.
# [Ctrl+l]
How to change hostname in RHEL/CentOS?
Answer:
1. To change the hostname, first change to the root account.
# su -
2. Run the system-config-network tool.
# system-config-network
Reboot your system to take effect.