Linux常见系统命令2
linux不同于Windows图形界面操作系统,远程登录往往只是命令行形式登录,所以必须使用命令完成操作。
所以,我们必须掌握这些基本的命令,跟着超易软件小编学习,掌握这些其实并不复杂。
这类命令涉及一些系统命令,需要知道有这些命令,如果记不住的话,可以参考拷贝命令执行。
显示操作系统 hostname
登录mysql mysql -u root -p 然后输入密码即可。
退出mysql登录 exit 回车即可
查看所有系统服务信息:systemctl list-units --type=service
查看mysql详细信息 systemctl status mysql.service
Mysql 停止合同重启服务
root@debian:/usr/local/mysql# service mysql stop
root@debian:/usr/local/mysql# service mysql start
查看开放端口 netstat -tuln
查看运行进程 ps aux 或者ps -elf
查看java 版本 java -version
查看是否安装了mysql mysql -version
获取tomcat 版本号,进入tomca安装目录
root@debian:/usr/local/tomcat10# cd bin
root@debian:/usr/local/tomcat10/bin# ./version.sh
解压命令
tar -zxvf jdk-8u341-linux-x64.tar.gz
查看CPU信息
# 查看系统内核信息
uname -a
# 查看系统内核版本
cat /proc/version
# 查看当前用户环境变量
env
cat /proc/cpuinfo
# 查看有几个逻辑cpu, 包括cpu型号
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
# 查看有几颗cpu,每颗分别是几核
cat /proc/cpuinfo | grep physical | uniq -c
# 查看当前CPU运行在32bit还是64bit模式下, 如果是运行在32bit下也不代表CPU不支持64bit
getconf LONG_BIT
# 结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit
cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l
查看设置固定IP
ifconfig em1 192.168.5.177 netmask 255.255.255.0
查看进程信息
top命令 可以查看,按一下q就退出top运行界面
ps -elf
查看磁盘空间命令
df -h
fdisk -l
1.安装gcc,gdb, libncurses5-dev
apt-get install make gcc
2.groupadd mysql
useradd -g mysql mysql
./configure --prefix=/home/mysql --with-mysqld-user=mysql && make && make install
3.cp support-files/my-medium.cnf /etc/my.cnf
cp /home/mysql/share/mysql/mysql.server /etc/init.d/mysqld
修改my.cnf打开innodb选项
/etc/init.d/mysqld start
mysqladmin -u root password '******'
/sbin/chkconfig --add mysqld
# cd /mnt/
# tar zxvf mysql-5.0.84.tar.gz
# cd mysql-5.0.84
# ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charset=all --enable-thread-safe-client --enable-local-infile --with-low-memory
说明:安装到=/usr/local/mysql 下,<a class="vLink9999" title="%u8425%u517B%u98DF%u8DB3 @utops.cc" style="font-size: 1em" target="_blank" onxxxxxxxxx="if(typeof(showTitle)!='amp;apos;#39;undefined'amp;apos;#39;){this.title='amp;apos;#39;'amp;apos;#39;;window.clearTimeout(hideTO);showTitle(event, this, 2,'amp;apos;#39;'amp;apos;#39;);}" onxxxxxxxx="if(typeof(showTitle)!='amp;apos;#39;undefined'amp;apos;#39;){mouseIsOverLayer = false; mouseOverWhileLoad = false; hideTO = window.setTimeout('amp;apos;#39;checkIfMouseOverLayer()'amp;apos;#39;,500);}" href="http://action.utops.cc/click.jsp?adsId=104&adsLeagueId=5&adsUserId=188&siteId=657&siteLeagueId=5&siteUserId=564&scId=2&adsType=2&prices=0.8&checkCode=d3d4201b7ece5c1ceb28f4170a1d5ed0_222.73.161.244&click=1&url=http%3A//www.abbottmama.com.cn/yingyangshizu/&v=0&keyword=%u8BED%u8A00&s=http%3A//www.linuxidc.com/Linux/2009-12/23230p2.htm&rn=781751---2010-4-14-10:46:22">语言用utf8
通到错误 :configure: error: no acceptable C compiler found in $PATH
说明没安gcc, <a class="vLink9999" title="%u52A8%u6F2B_1 @utops.cc" style="font-size: 1em" target="_blank" onxxxxxxxxx="if(typeof(showTitle)!='amp;apos;#39;undefined'amp;apos;#39;){this.title='amp;apos;#39;'amp;apos;#39;;window.clearTimeout(hideTO);showTitle(event, this, 1,'amp;apos;#39;'amp;apos;#39;);}" onxxxxxxxx="if(typeof(showTitle)!='amp;apos;#39;undefined'amp;apos;#39;){mouseIsOverLayer = false; mouseOverWhileLoad = false; hideTO = window.setTimeout('amp;apos;#39;checkIfMouseOverLayer()'amp;apos;#39;,500);}" href="http://action.utops.cc/click.jsp?adsId=412&adsLeagueId=5&adsUserId=1&siteId=657&siteLeagueId=5&siteUserId=564&scId=2&adsType=98&prices=1.51&checkCode=584773c37c55abe0109d8f59eed46f50_222.73.161.244&click=1&url=http%3A//www.foho.cc/totole/index.html&v=0&keyword=%u73B0%u5728&s=http%3A//www.linuxidc.com/Linux/2009-12/23230p2.htm&rn=895018---2010-4-14-10:46:22">现在安:
查看系统是否安装了gcc和安装程序的版本号:
gcc -v c++ -v g++ -v 如果没有就用 以下命令安装#yum install gcc #yum install gcc-c++ #yum install gcc-gfortran
再次:
# ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charset=all --enable-thread-safe-client --enable-local-infile --with-low-memory
还是出错:
checking for termcap functions library... configure: error: No curses/termcap library found
说明要安ncurses
#yum install ncurses-devel
提示安装N个软件,略, 按"y", 完成
再次:
# ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charset=all --enable-thread-safe-client --enable-local-infile --with-low-memory
出现:Thank you for choosing MySQL! 说明mysql安装的第一步成功
------------
# make && make install
如果 你的gcc-c++是在configure后安装的,再重新configure一下,可以会以下错误:
error: redeclaration of C++ built-in type ‘bool’
慢长的等待,安好了
groupadd mysql
useradd -g mysql mysql
cd /usr/local
mkdir mysql
下载源码:
cd /usr/src
wget http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.85.tar.gz
tar -xzvf mysql-5.0.85.tar.gz
cd mysql-5.0.85
编译参数(参照简朝阳前辈):
./configure --prefix=/usr/local/mysql/ --without-debug --without-bench --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-charset=latin1 --with-extra-charset=utf8,gbk --with-innodb --with-cvs-storage-engine --with-federated-storage-engine --with-mysqld-user=mysql --without-embedded-server --with-server-suffix=-community --with-unix-socket-path=/usr/local/mysql/sock/mysql.sock
出了点小错:
checking for termcap functions library... configure: error: No curses/termcap library found
解决方法:
sudo apt-get install libncurses5-dev
继续configure
....
make
...(屏幕疯狂的刷了15分钟)
make install
...
收尾设置:
cp support-files/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .
安装初始数据库:
bin/mysql_install_db --user=mysql
chown -R root .
chown -R mysql var
bin/mysqld_safe --user=mysql
添加mysql root密码:
/usr/local/mysql/bin/mysqladmin -u root password '12346'
添加启动文件:
cp ./support-files/mysql.server /etc/init.d/mysql
chmod 777 /etc/init.d/mysql
把mysql/bin添加到$PATH变量中:
export PATH=/usr/local/mysql/bin/:$PATH
或者修改/etc/profile文件
测试:
/etc/init.d/mysqld start
mysql -u root -p12346
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.04 sec)
联系电话:020-82327296 ,13570098458   QQ:52813524  515044158  
微信:13570098458 13694203350
广州市超易信息科技有限公司 广州市天河区黄村东路8号启星商务中心C区A栋3楼