2019-05-06 13:26:17 2342浏览
今天千锋扣丁学堂Linux培训老师给大家总结一下关于工作中常用到的Linux命令总结,大部分Linux开发人员在工作中多使用docker、kubernetes等开源工具。工作中基本都是基于Linux系统进行操作的。记录一下工作中常用到的Linux命令,每个命令搭配一定的参数使用会更加方便。这里只记录常用到的命令以及参数。
[root@k8s-master ~]# echo "hello world" hello world [root@k8s-master ~]# str="hello world" [root@k8s-master ~]# echo $str hello world
%t 跳格[tab 键] %H 小时(0~23) %I 小时(0~12) %M 分钟(0~59) %S 秒(0~59) %J 一年中的第几天 [root@k8s-master ~]# date Thu Apr 11 13:42:20 CST 2019 [root@k8s-master ~]# date "+%Y-%m-%d %H:%M:%S" 2019-04-11 13:43:41 [root@k8s-master ~]# date "+%j" 101
[root@k8s-master ~]# reboot
[root@k8s-master ~]# poweroff
[root@k8s-master ~]# ps aux
top - 10:41:34 up 12 days, 19:14, 2 users, load average: 1.00, 1.06, 0.92 Tasks: 635 total, 2 running, 633 sleeping, 0 stopped, 0 zombie %Cpu(s): 4.6 us, 1.2 sy, 0.0 ni, 92.1 id, 1.7 wa, 0.0 hi, 0.1 si, 0.3 st KiB Mem : 16268340 total, 7407372 free, 4552160 used, 4308808 buff/cache KiB Swap: 0 total, 0 free, 0 used. 10456728 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 32056 root 20 0 868460 790968 42808 S 25.2 4.9 1915:18 kube-apiserver
[root@k8s-master ~]# pidof java 27775
[root@k8s-master ~]# ifconfig ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.223.16 netmask 255.255.255.0 broadcast 192.168.223.255 inet6 fe80::20c:29ff:fede:d1af prefixlen 64 scopeid 0x20<link> ether 00:0c:29:de:d1:af txqueuelen 1000 (Ethernet) RX packets 66 bytes 8951 (8.7 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 88 bytes 10153 (9.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@k8s-master ~]# uname -a Linux mysql 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@k8s-master ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core)
[root@k8s-master ~]# uptime 11:15:53 up 14 min, 2 users, load average: 0.00, 0.04, 0.05
[root@k8s-master ~]# free -h total used free shared buff/cache available Mem: 15G 4.4G 6.7G 739M 4.4G 9.8G Swap: 0B 0B 0B
[root@k8s-master ~]# history 1 ls 2 cd / 3 ls 4 hostname 5 ls 6 cd mysql/ 7 ls 8 cd data/
[root@k8s-master ~]# pwd /root
[root@k8s-master ~]# cd /home/ [root@k8s-master home]#
[root@kubemaster home]# ls config docker software test.yaml [root@kubemaster home]# ls -l total 12 drwxr-xr-x 4 root root 35 Feb 13 09:46 config drwx--x--x 11 root root 130 Mar 11 16:37 docker drwxr-xr-x 4 root root 30 Jan 10 14:08 software -rw-r--r-- 1 root root 234 Sep 6 2018 test.yaml
[root@kubernetes ~]# mkdir -p /a/b/c [root@kubernetes ~]# cd /a/b/c [root@kubernetes c]# pwd /a/b/c
[root@kubernetes ~]# cp install.log x.log [root@kubernetes ~]# ls install.log x.log
[root@kubernetes ~]# mv x.log linux.log [root@kubernetes ~]# ls install.log linux.log
[root@kubernetes ~]# rm install.log rm: remove regular empty file ‘install.log'? y [root@kubernetes ~]# rm -f linux.log [root@kubernetes ~]# ls [root@kubernetes ~]#
【关注微信公众号获取更多学习资料】 【扫码进入HTML5前端开发VIP免费公开课】