Common commands for Linux systems (ii)

Source: Internet
Author: User

1.11. View all environment variables

Env or set

Set is to view all environment variables, including env

1.12. root user settings can be logged in directly after operating system hardening

after the operating system is hardened,the root user cannot log in directly, first log on as a normal user, and then switch to the root user

Su-root

Vi/etc/ssh/sshd_config

Change Permitrootlogin Yes

make it effective after saving: /etc/init/sshd restart

1.13. Modify the server host name

(1) modify the "/etc/hosatname" file, the host name of the planning reference hostname and IP address

Vi/etc/hostname

Modify the host name to resemble the following:Tdsysapp

(2) modify "/etc/hosts"

Vi/etc/hosts

the host name and IP is modified to resemble the following:

10.71.128.200 Tdsysapp

(3) Modify environment variables:Hostname=tdsysapp

(4) Run the following command, which is the modified host name in effect

/etc/rc.d/boot,localnet stop

/etc/rc.d/boot.localnet start

1.14. View information in all text files that contain a keyword

Cat ' find/opt/huawei/td/-name "*.properties" ' |grep passwd

1.15. Activation Connection failed:device not managed by NetworkManager

Service NetworkManager Stop

To prevent the service from restarting the next time it is started, workaround:

Chkconfig NetworkManager off

Then restart the network card:

Service Network restart

1.16. Configure IP

Vi/etc/sysconfig/network-scripts/ifcfg-eth0

ipaddr=192.168.4.10

netmask=255.255.255.0

gateway=192.168.4.1

Onboot=yes

Bootproto=none

1.17. View all user information for the system

cat/etc/passwd

Tduser:x:750:700::/home/tduser/bin/bash

User name: password: User ID: Group ID: Description: Home directory: Default Shell

1.18. View all user group information

Cat/etc/group

1.19. Background Timer Tasks

Crontab-l/ View timed Tasks

CRONTAB-E/ Edit Background Timer task

To make a scheduled task effective:/etc/init.d/cron restart or service cron Restart

1.20. Create a text file

Copy file 1 to file 2:cat file1 >file2

combine several small files into one file:cat file1 file2 ... >file

Create an empty text file:cat/dev/null >test.txt

Create an empty text file:touch test.txt

Common commands for Linux systems (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.