Linux empty files and other useful instructions summary _linux

Source: Internet
Author: User

1). > filename

2).:> filename

3. echo "" > filename (file size truncated to 1 bytes)

4). echo > FileName

5). cat/dev/null > FileName

6). cp/dev/null filename

Cat A.log >> b.log add content from a append to B

Cat A.log > B.log writes the contents of A to B and covers the contents of B Central


View newest logfile:tail-f logfile


View all installed packages packages for the system: dpkg-query-l

Viewing services for System sniffing

# NETSTAT-LN

If you need to see all the processes currently running on your system, you need to use the following command:

# PS AUXW

service[Service Name] Perform action

Options and Parameters:

To perform an action: the work to be done by a service (Start|stop|status|restart ...)

--status-all: Display all of the system's self-boot services

Format: Service <service>

Print command line usage Help for the specified service <service>.


Format: Service <service> start

Start the specified system service <service>


Format: Service <service> stop

Stop the specified system service <service>


Format: Service <service> restart

Restarts the specified system service <service>, stopping (stop) before starting (start).


format: Chkconfig--list

View the list of system services and the level of operation for each service.


format: Chkconfig <service> on

Sets the specified service <service> starts automatically when it is powered on.


format: chkconfig <service> off

Sets the specified service <service> does not start automatically when the machine is open.

It can be divided into 2 categories according to how the service is started:

Self-initiated services: Most of the services that will be started when powered on. Each service has a process to control

Unified Control Start Service: A separate process is responsible for starting these services, as to when the user control is initiated. This independent process is xinetd.

The Unified control boot service is also a self starter service, but its controlled service does not necessarily boot on

A few important catalogs

/etc/init.d/: All service startup Script Repository (Learn shell script syntax good place)
/etc/sysconfig/(Initialization environment profile for each service)
/etc/xined.conf Unified Control Start service overall configuration file
/etc/xined.d/Unified Control Start service profile (profile for each service)
/etc/: Self-starting service individual profiles
/var/lib/the respective profiles of the self-boot service
/var/run/: PID records for each service's program

The above Linux empty files and other useful instructions summary is small to share all the content of everyone, hope to give you a reference, but also hope that we support the cloud habitat community.

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.