In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
What are the linux commands? for this question, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
I. Management of the file system
Tips: when entering commands, you should use the tab key to complete.
Ls to view directory information (ls /)
Ls-l is equivalent to ll.
Pwd to view the current path
Cd switch directory (cd /), if there are no parameters, switch to user home directory ~
Mkdir create folder
Rmdir deletes empty folders (only empty folders can be deleted)
Rm-r / a ram b (delete a non-empty folder)
Create a file
Touch a.avi creates an empty file
Vi blabla.txt edits a file with a text editor and saves
Echo "angelababy,zhen de hen xihuan ni" > qingshu.txt put the output on the left into the file on the right
Delete a file
Rm filename (rm-r delete folder rm-rf force deletion of files or folders)
Move the file to change the file name
Mv a/wenjian1.txt b/file1.txt (changes the file name while moving the file)
Copy a file
Cp srcFile destFile
View the contents of the file
Cat wodeqingshu.txt
More wodeqingshu.txt can be viewed in pages.
Less wodeqingshu.txt not only can be paged, but also can easily search, flip back and other operations.
Tail-10 wodeqingshu.txt View the 10 lines at the end of the file
The log printed by the program is of extraordinary debug significance in production practice.
Tail-f user.log refreshes the tail of the display file in real time
Head-20 wodeqingshu.txt View the first 20 lines of the file
II. Authority management
Drwxrwxr-x
Modify permissions
Chmod u+rwx file adds or removes the permissions of its users for file
(U on behalf of user o, on behalf of other users g, on behalf of members of the group)
Chmod 567file can also represent permissions with numbers
5-> 101-> rmurx
Modify the owner of the file owner
Chown hadoop:hadoop file changes the owner of file to hadoop user and the group he belongs to to hadoop group
The permissions of the parent directory also have restrictions on the operation of files or folders at the same level.
III. User management
Add user
Useradd itcast0830
You must set a password to log in to passwd itcast0830 properly
Delete user
Userdel yun12
Userdel-r itcast-Delete the user's home directory while deleting the user
Modify user properties
Usermod-l b a changes the login name of a to b
Usermod-g hadoop itcast0830 changes the itcast0830 group to the hadoop group
Usermod-G hadoop,root itcast0830 adds two groups hadoop,root to itcast0830
Usermod-d / home/itcast itcast0830 changes the home directory of itcast0830 to / home/itcast
(create the itcast directory in advance and copy the environment variable file)
-modify the user's password
Passwd itcast0830
Add a user group
G
Roupadd beauties
Delete a user group
Groupdel beauties
Modify user group properties
Groupmod
View the identity of the current login
Whoami
View the groups that are currently in use
Groups
Fourth, common system management (when it comes to modification, be sure to use root permissions)
****
Easily do not use su to switch to the identity of root
Ordinary users use sudo to execute commands for root permissions
For example, add hadoop users to the sudoers file
Root ALL= (ALL) ALL
Hadoop ALL= (ALL) ALL
Disk space information view
Df-h view disk space status information
Du-sh * View the summary size of all subdirectories and files under the current directory
Process information view
Free to check memory usage
Top to view the system process information refreshed in real time
Ps-ef to view snapshots of process information in the current instant in the system
Ps-ef | grep myshell.sh searches myshell process information
Kill-9 pid kills the process (- 9 means forced kill)
5. File archiving compression (1: packaging-archiving; 2: compression)
1. Filing
Tar-cvf testdir.tar testdir/
2. Compression
Gzip testdir.tar
Gzip file
Bzip file
Tar-czvf testdir.tar.gz testdir/
Extract tar-xzvf testdir.tar.gz to the current directory
Tar-zxvf testdir.tar.gz-C Downloads/ is extracted to the specified Downloads directory
VI. Network management
Modify the configuration of the ip address
Vi / etc/sysconfig/network-scripts/ifcfg-eth0 can change the ip address by modifying the configuration file
Or use the setup instruction to modify it through a pseudo graphical interface with prompts.
View ip addr
Ifconfig
Modify hostname
Vi / etc/sysconfig/network modifies the hostname configuration item in it
To take effect immediately, you can execute the instruction hostname nidezhujiming.
HOSTNAME=yun12-01
Manage the hostname of the private network-ip address mapping
Vi / etc/hosts
192.168.2.250 yun12-01
Restart network services
Service network restart under root permission
Turn off the firewall service service iptables stop
Turn off the firewall and start chkconfig iptables off automatically
Modify the default startup level of the system
Vi / etc/inittab
# 0-halt (Do NOT set initdefault to this)
# 1-Single user mode
# 2-Multiuser, without NFS (The same as 3, if you do not have networking)
# 3-Full multiuser mode
# 4-unused
# 5-X11
# 6-reboot (Do NOT set initdefault to this)
#
Id:3:initdefault:
~
Start the full-function character interface with level 3
View the information about the current process connecting to the network
Netstat-nltp
Common tool instructions
Wc statistics text information (lines, words, characters)
Date and time when date views or modifies the system
Echo outputs the value of a string or variable
The most common text editor in vi linux system
VI. Software installation in linux
Jdk
Unpack the installation package to your installation path
Then modify the environment variable sudo vi / etc/profile
Then source / etc/profile will take effect.
Tomcat
Eclipse
Mysql
Redhat's RPM package management is also a commonly used package manager.
Rpm-qa | grep mysql
Sudo rpm-e mysql-libs-5.1.66-2.el6_3.i686-- nodeps
Sudo rpm-ivh MySQL-server-5.1.73-1.glibc23.i386.rpm
The answers to the questions about the linux command are shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 263
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.