亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Home php教程 PHP開發(fā) Common Linux commands

Common Linux commands

Nov 19, 2016 am 09:38 AM
linux

1. cd

cd ~username: The command is used to switch directories, and can also switch the user's home directory.

[root@localhost ~]# cd ~123

[root@localhost 123]# pwd #View the current path

/home/123

The user’s home directory is a folder created for a specific user. The user The user has ownership of the contents of this folder, but not all programs in the user's home directory belong to the user. The owner of the test2 file below is root, because it is a file created with root permissions, and a test2 with read-only permissions is created on the desktop.

[root@localhost Desktop]# touch test2

[root@localhost Desktop]# ls -l

total 2220

-rw-r--r--. 1 root root 2272130 Aug 6 2013 cacti-0.8. 8b.tar.gz

-rw-rw-r--. 1 123 123 0 Nov 1 03:38 new file

-rw-rw-r-- 1 123 123 0 Nov 17 22:42 new file (copy )

-rw-r--r-- 1 root root 0 Nov 17 23:16 test2

If you log in to the 123 user through su and create a test4 file, its owner belongs to the 123 user and has Read and write permissions.

[123@localhost Desktop]$ su 123

Password:

[123@localhost Desktop]$ ls

cacti-0.8.8b.tar.gz new file new file (copy) test2 test3

[123@ localhost Desktop]$ touch test4

[123@localhost Desktop]$ ls -l

total 2220

-rw-r--r--. 1 root root 2272130 Aug 6 2013 cacti-0.8.8b.tar.gz

-rw-rw-r--. 1 123 123 0 Nov 1 03:38 new file

-rw-rw-r-- 1 123 123 0 Nov 17 22:42 new file (copy)

-rw -r--r-- 1 root root 0 Nov 17 23:16 test2

-rw-rw-r-- 1 123 123 0 Nov 17 23:18 test3

-rw-rw-r-- 1 123 123 0 Nov 17 23:20 test4

2, type

The type of command can be realized through the type command. Commands in Linux are divided into internal commands and external commands.

[123@localhost Desktop]$ type cut

cut is /usr/bin/cut #External command (in a corresponding directory)

[123@localhost Desktop]$ type echo

echo is a shell builtin #Internal command

3, printenv

Through this command, you can view the environment variable information of the system. The environment variable information has the same meaning as the JAVA setting. Among a lot of information, only PATH is the environment variable information. . Newly developed programs must also be set in environment variables.

[root@localhost Desktop]# printenv

ORBIT_SOCKETDIR=/tmp/orbit-123

HOSTNAME=localhost.localdomain

TERM=xterm

SHELL=/bin/bash

XDG_SESSION_COOKIE=2604b 541bf302be0cd47ddec00000011-1479446380.885020-236895646

HISTSIZE=1000

GTK_RC_FILES=/etc/gtk/gtkrc:/home/123/.gtkrc-1.2-gnome2

WINDOWID=46138793

USER=123

LS_COLORS=rs=0:di=01; 34: ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31; 01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex= 01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01; 31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31: *.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.tbz=01;31:*.tbz2=01;31:*. bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace= 01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01; 35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35: *.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*. svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v= 01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01; 35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35: *.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*. xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx= 01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01; 36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36: *.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:

GNOME_KEYRING_SOCKET=/tmp/keyring-ejyje6 /socket

SSH_AUTH_SOCK=/tmp/keyring-ejyje6/socket.ssh

SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/2354,unix/unix:/tmp/.ICE-unix/2354

USERNAME=123

DESKTOP_SESSION=gnome

MAIL=/var/spool/mail/123

PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin :/sbin:/home/123/bin

PWD=/home/123/Desktop

GDM_KEYBOARD_LAYOUT=us

LANG=en_US.UTF-8

GNOME_KEYRING_PID=2344

GDM_LANG=en_US.UTF-8

GDMSESSION=gnome

SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass

HISTCONTROL=ignoredups

HOME=/root

SHLVL=11

GNOME_DESKTOP_SESSION_ID=this-is-deprecated

LOGNAME=123

DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-MMUi3C39vL,guid=b6fecbcb44a8fd92e501ec9b0000003d

LESSOPEN=|/usr/bin/lesspipe.sh %s

WINDOWPATH=1

DISPLAY=:0.0

G_BROKEN_FILENAMES=1

COLORTERM=gnome-terminal

_=/usr/bin/printenv

4 , hash

The hash command is used to display the number of times the command is tapped on the screen. hash -r is used to clear the cache information of this command. When the command used in the hash is used again, it will not be called in the kernel, but will be removed directly from the cached KV (key value) database, which will be very fast.

[root@localhost Desktop]# hash

hitscommand

1/bin/grep

1/bin/vi

1/usr/bin/man

2/usr/bin/printenv

1/usr /bin/clear

5, date

Display the system time. The system time here is the kernel time of the system. The kernel time is the simulated time oscillator for timing. After the system is installed, the hardware time of the host will be read, and then it will Time it yourself. Use date -u month day hour minute year. second to set the system time.

[root@localhost Desktop]# date -u 1118160216.30

Fri Nov 18 16:02:30 UTC 2016

The date command also includes some wildcard options, taking 2016/11/18 as an example, %y=16 ,%m=11,%d=18, when using wildcard fields, + must be added after date.

[root@localhost Desktop]# date

Fri Nov 18 16:11:13 PST 2016

[root@localhost Desktop]# date +%y

16

[root@localhost Desktop]# date +% m

11

[root@localhost Desktop]# date +%d

18

The output effect of changing the letters after the wildcard character to uppercase is like this

[root@localhost Desktop]# date +%Y

2016

[root@localhost Desktop]# date +%M

13

[root@localhost Desktop]# date +%D

11/18/16

date can also output text

[root @localhost Desktop]# date +"today is %d"

today is 18

[root@localhost Desktop]# date +"this year is %Y"

this year is 2016

6、clock,hwclock

As mentioned before, in addition to the date that can check the current time, there is also the hardware time that can be checked through the clock. The clock and date times may be different.

[root@localhost Desktop]# date

Fri Nov 18 16:22:02 PST 2016

[root@localhost Desktop]# clock

Fri 18 Nov 2016 12:22:45 AM PST -0.906975 seconds

The above system time is different from the hardware time. The system time is correct and can be modified through hwclock -w.

[root@localhost Desktop]# hwclock -w

[root@localhost Desktop]# clock

Fri 18 Nov 2016 04:24:43 PM PST -0.141483 seconds

[root@localhost Desktop]# date

Fri Nov 18 16:24:51 PST 2016

There is also a command cal to view the calendar of the current year, cal -y to view the specified year.

[root@localhost Desktop]# cal

November 2016

Su Mo Tu We Th Fr Sa

1 2 3 4 5

6 7 8 9 10 11 12

13 14 15 16 17 18 19

20 21 22 23 24 25 26

27 28 29 30


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1488
72
How does resource usage (CPU, memory) differ between Linux and Windows? How does resource usage (CPU, memory) differ between Linux and Windows? Jun 05, 2025 am 12:13 AM

Linux and Windows have their own advantages and disadvantages in CPU and memory usage: 1) Linux uses time slice-based scheduling algorithms to ensure fairness and efficiency; Windows uses priority scheduling, which may cause low-priority processes to wait. 2) Linux manages memory through paging and switching mechanisms to reduce fragmentation; Windows tends to pre-allocate and dynamic adjustment, and efficiency may fluctuate.

How does the cost of ownership differ between Linux and Windows? How does the cost of ownership differ between Linux and Windows? Jun 09, 2025 am 12:17 AM

Linux's cost of ownership is usually lower than Windows. 1) Linux does not require license fees, saving a lot of costs, while Windows requires purchasing a license. 2) Linux has low hardware requirements and can extend the service life of the device. 3) The Linux community provides free support to reduce maintenance costs. 4) Linux is highly secure and reduces productivity losses. 5) The Linux learning curve is steep, but Windows is easier to use. The choice should be based on specific needs and budget.

How does the performance of I/O operations differ between Linux and Windows? How does the performance of I/O operations differ between Linux and Windows? Jun 07, 2025 am 12:06 AM

LinuxoftenoutperformsWindowsinI/Operformanceduetoitscustomizablekernelandfilesystems,whileWindowsoffersmoreuniformperformanceacrosshardware.1)LinuxexcelswithcustomizableI/OschedulerslikeCFQandDeadline,enhancingperformanceinhigh-throughputapplications

How to install Linux alongside Windows (dual boot)? How to install Linux alongside Windows (dual boot)? Jun 18, 2025 am 12:19 AM

The key to installing dual systems in Linux and Windows is partitioning and boot settings. 1. Preparation includes backing up data and compressing existing partitions to make space; 2. Use Ventoy or Rufus to make Linux boot USB disk, recommend Ubuntu; 3. Select "Coexist with other systems" or manually partition during installation (/at least 20GB, /home remaining space, swap optional); 4. Check the installation of third-party drivers to avoid hardware problems; 5. If you do not enter the Grub boot menu after installation, you can use boot-repair to repair the boot or adjust the BIOS startup sequence. As long as the steps are clear and the operation is done properly, the whole process is not complicated.

How to enable the EPEL (Extra Packages for Enterprise Linux) repository? How to enable the EPEL (Extra Packages for Enterprise Linux) repository? Jun 17, 2025 am 09:15 AM

The key to enabling EPEL repository is to select the correct installation method according to the system version. First, confirm the system type and version, and use the command cat/etc/os-release to obtain information; second, enable EPEL through dnfinstallepel-release on CentOS/RockyLinux, and the 8 and 9 version commands are the same; third, you need to manually download the corresponding version of the .repo file and install it on RHEL; fourth, you can re-import the GPG key when encountering problems. Note that the old version may not be supported, and you can also consider enabling epel-next to obtain the test package. After completing the above steps, use dnfrepolist to verify that the EPEL repository is successfully added.

How does Linux perform compared to Windows for web server workloads? How does Linux perform compared to Windows for web server workloads? Jun 08, 2025 am 12:18 AM

Linux usually performs better in web server performance, mainly due to its advantages in kernel optimization, resource management and open source ecosystem. 1) After years of optimization of the Linux kernel, mechanisms such as epoll and kqueue make it more efficient in handling high concurrent requests. 2) Linux provides fine-grained resource management tools such as cgroups. 3) The open source community continuously optimizes Linux performance, and many high-performance web servers such as Nginx are developed on Linux. By contrast, Windows performs well when handling ASP.NET applications and provides better development tools and commercial support.

How to choose a Linux distro for a beginner? How to choose a Linux distro for a beginner? Jun 19, 2025 am 12:09 AM

Newbie users should first clarify their usage requirements when choosing a Linux distribution. 1. Choose Ubuntu or LinuxMint for daily use; programming and development are suitable for Manjaro or Fedora; use Lubuntu and other lightweight systems for old devices; recommend CentOSStream or Debian to learn the underlying principles. 2. Stability is preferred for UbuntuLTS or Debian; you can choose Arch or Manjaro to pursue new features. 3. In terms of community support, Ubuntu and LinuxMint are rich in resources, and Arch documents are technically oriented. 4. In terms of installation difficulty, Ubuntu and LinuxMint are relatively simple, and Arch is suitable for those with basic needs. It is recommended to try it first and then decide.

How to add a new disk to Linux How to add a new disk to Linux Jun 27, 2025 am 12:15 AM

The steps to add a new hard disk to the Linux system are as follows: 1. Confirm that the hard disk is recognized and use lsblk or fdisk-l to check; 2. Use fdisk or parted partitions, such as fdisk/dev/sdb and create and save; 3. Format the partition to a file system, such as mkfs.ext4/dev/sdb1; 4. Use the mount command for temporary mounts, such as mount/dev/sdb1/mnt/data; 5. Modify /etc/fstab to achieve automatic mount on the computer, and test the mount first to ensure correctness. Be sure to confirm data security before operation to avoid hardware connection problems.

See all articles