UNIX.

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

This paper will be updated, it should be with my experience of using UNIX and continuous extension.


2013/11/21 statistical folder size

du -sh ./

Where s represents the disk size, H represents the display results in readable form.


2013/11/21 new user

useradd –d /usr/sam -m sam

Where D and m are creating new user user directory and name. But also need to create a user password for the user, the account to use.

passwd sam

New password:*******

Re-enter new password:*******

Passwd be root user.


2013/11/22 for ordinary users to add sudo permissions

First use the account login system has sudo permissions, such as root users.

Then open the /etc/sudoers file with an editor such as vi.

Find the root ALL= (ALL) ALL, add the UserName ALL= on the next line (ALL) ALL.


2013/11/22 unzip

Tar -zxvf is the most common, a lazy, then added.



2013/11/22 open SSH service

SSH client for openssh-client and openssh-server, if you just want to visit other machines SSH only need to install openssh-client, if you want to make the machine open SSH service you need to install openssh-server.


2013/11/22 under the Ubuntu open root users

sudo passwd root

Set the password on the line.


2013/11/22 SCP command

SCP is a Security copy file, based on the SSH login. The operation is more convenient, such as the current copy a file to the remote another host, can the following command.

scp /home/daisy/full.tar.gz root@172.19.2.75:/home/root

Then you will be prompted to enter the other 172.19.2.75 hosts root user login password, then began to copy.

If you want to turn operation, put a file from a remote host copy to the current system, is also very simple.

scp root@/full.tar.gz172.19.2.75:/home/root/full.tar.gzhome/daisy/full.tar.gz

The Linux SCP command to copy files and directories in Linux,

==================
The SCP command
==================
SCP can copy the files in the 2 Linux hosts,

Basic command type :
[optional] file_source file_target SCP

======
From the local copy to the remote
======
* Copy file:
* The command type:
scp local_file remote_username@remote_ip:remote_folder
Or
scp local_file remote_username@remote_ip:remote_file
Or
scp local_file remote_ip:remote_folder
Or
scp local_file remote_ip:remote_file

The 1,2 specifies the user name, command is executed after need to input the password, first only specify a remote directory, file name unchanged, second specifies the file name,
The 3,4 does not specify a username, command execution after the need to enter a user name and password, third only specify a remote directory, file name unchanged, fourth specifies the file name,
* Example:
scp /home/space/music/1.mp3 :/home/root/others/music
scp /home/space/music/1.mp3 :/home/root/others/music/001.mp3
scp /home/space/music/1.mp3 www.cumt.edu.cn:/home/root/others/music
scp /home/space/music/1.mp3 www.cumt.edu.cn:/home/root/others/music/001.mp3

* Copy directory:
* The command type:
scp -r local_folder remote_username@remote_ip:remote_folder
Or
scp -r local_folder remote_ip:remote_folder

First specify the username, command is executed after need to enter the password again,
Second do not specify the username, command execution need to enter a user name and password,
* Example:
scp -r /home/space/music/ :/home/root/others/
scp -r /home/space/music/ www.cumt.edu.cn:/home/root/others/

The above command will local music directory to the others directory replication distance, namely after the remote../others/music/ directory


======
From the remote copy to the local
======
From the remote copy to the local, as long as the local copy to the remote command post 2 parameters can change order,

For example:
scp :/home/root/others/music /home/space/music/1.mp3
scp -r www.cumt.edu.cn:/home/root/others//home/space/music/

The following application of the most simple :

SCP local user @IP address: file name 1 remote user @IP address: file name 2

Local @IP address: [username] can not input, may need to input corresponding to the remote user name password.

Several parameters may be useful to :

-v and most of the Linux command in -v, used to display the progress. Can be used to view the connection, certification, or configuration error.

-C enable compression options.

-P select the port. Note that -p is used by RCP.

-4 is forced to use the IPV4 address.

-6 is forced to use the IPV6 address.


Two points for attention:
1 if the remote server firewall has special restrictions, SCP would go special port, what specific port depending on the situation, type the following command :
#scp -p 4588 :/usr/local/sin.sh /home/administrator
2 using SCP should pay attention to whether the user can read the remote server corresponding file permissions.





2013/11/25 modification to the system

(1)Will be rescheduled for October 11th at one fifty-five in the morning: data 10110155
(2)To set the system time of August 8, 2005: date -s 2005/08/08
(3)The system time is set to 0 seconds at eight twelve in the afternoon: date -s 20:12:00
This command is used to modify the system clock. When the system starts, Linux operating system will be time to read the system time variables from CMOS, then modified by modifying the system time. In order to maintain consistency of system time and CMOS time, Linux every other period of time will be written into the CMOS system time. Because the synchronization is every other period of time (about 11 minutes) of the date, -s command, if immediately restart the system, the modification time might not be written to the CMOS. If you want to ensure that changes to take effect, the best use of the clock -w this command sets the system time to write CMOS.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Sherry at December 12, 2013 - 2:04 PM