Linux基础学习-基本命令
基本命令
date命令
参数 | 作用 |
---|---|
%t | 跳格 |
%H | 小时(00-23) |
%I | 小时(00-12) |
%M | 分钟(00-59) |
%S | 秒(00-59) |
%j | 今年中的第几天 |
[root@qdlinux Documents]# date
Fri Aug 31 22:05:03 CST 2018
[root@qdlinux Documents]# date "+%Y-%m-%d %H:%M-%S"
2018-08-31 22:05-57
[root@qdlinux Documents]# date "+%Y-%m-%d %I:%M-%S"
2018-08-31 10:06-38
[root@qdlinux Documents]# date "+%j"
243
wget命令
参数 | 作用 |
---|---|
-b | 后台下载模式 |
-P | 下载到指定的目录 |
-t | 最大尝试次数 |
-c | 断点续传 |
-p | 下载页面内所有资源,包括图片,视频等 |
-r | 递归下载 |
[root@qdlinux Documents]# wget https://www. linux probe .com/docs/LinuxProbe.pdf
ps命令
参数 | 作用 |
---|---|
-a | 显示所有进程(包括其他用户的进程) |
-u | 用户以及其他详细信息 |
-x | 显示没有控制终端的进程 |
[root@qdlinux Documents]# ps -aux
top命令
- R:正在运行,正在为用户提供服务
- S:正在休眠,等待为用户提供服务
- D:进程不可中断
- Z:僵死,僵尸进程
- T:已经停止
[root@qdlinux Documents]# top
top - 22:17:38 up 3 days, 13:27, 3 users, load average: 0.02, 0.04, 0.07
Tasks: 208 total, 1 running, 207 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.5 us, 0.3 sy, 0.0 ni, 99.2 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 2030172 total, 71556 free, 923720 used, 1034896 buff/cache
KiB Swap: 2097148 total, 1944316 free, 152832 used. 810872 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
13292 root 20 0 2177072 204976 27668 S 1.0 10.1 52:20.88 firefox
560 root 20 0 320064 2836 2328 S 0.7 0.1 26:39.01 vmtoolsd
61616 root 20 0 161972 2320 1580 R 0.7 0.1 0:00.23 top
559 root 20 0 21664 964 804 S 0.3 0.0 2:53.58 irqbalance
2154 root 20 0 488996 20652 3216 S 0.3 1.0 8:46.37 containerd
2557 root 20 0 547932 29992 9424 S 0.3 1.5 14:19.50 dockerd
12950 root 20 0 731256 7456 2364 S 0.3 0.4 2:34.16 gsd-color
13092 root 20 0 402992 6844 2412 S 0.3 0.3 17:43.46 vmtoolsd
61020 root 20 0 0 0 0 S 0.3 0.0 0:11.00 kworker/0:0
1 root 20 0 125632 3492 2172 S 0.0 0.2 0:35.90 systemd
[root@qdlinux Documents]# uptime
22:29:43 up 3 days, 13:39, 3 users, load average: 0.02, 2.05, 2.42
[root@qdlinux Documents]# uname -a
Linux qdlinux.com 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@qdlinux Documents]# uname -snrvmpio
Linux qdlinux.com 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@qdlinux Documents]# free
total used free shared buff/cache available
Mem: 2030172 704064 106192 6116 1219916 1044096
Swap: 2097148 151296 1945852
[root@qdlinux Documents]# free -m
total used free shared buff/cache available
Mem: 1982 687 103 5 1191 1019
Swap: 2047 147 1900
[root@qdlinux Documents]# free -h
total used free shared buff/cache available
Mem: 1.9G 687M 103M 6.0M 1.2G 1.0G
Swap: 2.0G 147M 1.9G
[root@qdlinux Documents]# free -k
total used free shared buff/cache available
Mem: 2030172 704176 106060 6116 1219936 1043984
Swap: 2097148 151296 1945852
wc命令
参数 | 作用 |
---|---|
-l | 只显示行数 |
-w | 只显示单词数 |
-c | 只显示字节数 |
[root@qdlinux ~]# cat anaconda-ks.cfg | tr [a-z] [A-Z]
[root@qdlinux ~]# wc -l /etc/passwd
43 /etc/passwd
[root@qdlinux ~]# wc -w /etc/passwd
85 /etc/passwd
[root@qdlinux ~]# wc -c /etc/passwd
2245 /etc/passwd
[root@qdlinux ~]# stat initial-setup-ks.cfg
File: ‘initial-setup-ks.cfg’
Size: 1783 Blocks: 8 IO Block: 4096 regular file
Device: 803h/2051d Inode: 67157617 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-08-31 22:39:00.663764363 +0800
Modify: 2018-08-04 15:07:54.860635244 +0800
Change: 2018-08-04 15:07:54.860635244 +0800
Birth: -
[root@qdlinux ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@qdlinux ~]# cut -d: -f1 /etc/passwd
[root@qdlinux ~]# dd if=/dev/zero of=560_file count=1 bs=560M
grep命令
参数 | 作用 |
---|---|
-b | 将可执行文件当做文本文件来搜索 |
-c | 仅显示找到的行数 |
-i | 忽略大小写 |
-n | 显示行号 |
-v | 反向选择 |
-E |
find命令
参数 | 作用 |
---|---|
-name | 匹配名称 |
-perm | 匹配权限 |
-user | 匹配所有者 |
-group | 匹配所有组 |
-mtime -n +n | 匹配修改内容的时间 (-n n天以内 +n n天以前) |
-atime -n +n | 匹配访问文件的时间 (-n n天以内 +n n天以前) |
-ctime -n +n | 匹配修改文件权限的时间 (-n n天以内 +n n天以前) |
-nouser | 匹配无所有者的文件 |
-nogroup | 匹配无所有组的文件 |
-newer f1 !f2 | 匹配比文件f1新但比f2旧的文件 |
--type b/d/c/p/l/f | 匹配文件类型 |
-size | 匹配文件的大小 |
-prune | 忽略某个目录 |
-exec {} \ ; | 后面可跟用于进一步处理搜索结果的命令 |
快照虚拟机网卡问题解决
[root@www ~]# rm -f /etc/udev/rules.d/70-persistent-net.rules
CentOS6中设置开机自启动
[root@www tools]# chkconfig --list sshd
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@www tools]# echo /etc/init.d/sshd start >> /etc/rc.local
[root@www tools]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
/etc/init.d/sshd start
[root@www tools]# chkconfig --level 345 sshd off
[root@www tools]# chkconfig --list sshd
sshd 0:off 1:off 2:on 3:off 4:off 5:off 6:off
[root@www tools]# chkconfig --level 345 sshd on
[root@www tools]# chkconfig --list sshd
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
linux启动流程
- Bios自检
- MBR引导
0柱面0磁道1扇区 前446字节 - grub引导菜单
- 加载kernel
- 启动init进程
- 读取inittab文件
开启需要的服务
[root@www tools]# chkconfig --list | grep 3:on| egrep -v "sshd|sysstat|network|crond|rsyslog" | awk '{print "chkconfig",$1,"off"}'|bash
[root@www tools]# chkconfig --list | grep 3:on | awk '{print "chkconfig",$1,"off"}'
[root@www tools]# chkconfig --list | grep -E "sshd|rsyslog|network|sysstat|crond"|awk '{print "chkconfig",$1,"on"}'
awk命令
mkdir /tools
cat /etc/passwd > /tools/awkfile.txt
[root@www tools]# awk 'NR==1 {print NR,$1}' awkfile.txt
1 root:x:0:0:root:/root:/bin/bash
awk -F ":" 'NR>=2&&NR<=5{print $1,$3}' /tools/awkfile.txt
[root@www tools]# awk -F ":" 'NR==1 {print NR,$1,$NF}' awkfile.txt
1 root /bin/bash
[root@www tools]# awk 'NR>=2 && NR<=5 {print NR,$1,$5}' awkfile.txt
2 bin:x:1:1:bin:/bin:/sbin/nologin
3 daemon:x:2:2:daemon:/sbin:/sbin/nologin
4 adm:x:3:4:adm:/var/adm:/sbin/nologin
5 lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
chgrp命令
[root@mail ~]# groupadd testgroup
[root@mail ~]# mkdir testdir
[root@mail ~]# ls
anaconda-ks.cfg testdir 公共 视频 文档 音乐
initial-setup-ks.cfg typechoDB.dump 模板 图片 下载 桌面
[root@mail ~]# ls -ld testdir
drwxr-xr-x. 2 root root 6 9月 8 19:37 testdir
[root@mail ~]# chgrp testgroup testdir
[root@mail ~]# ls -ld testdir
drwxr-xr-x. 2 root testgroup 6 9月 8 19:37 testdir
[root@mail ~]# chgrp -R testgroup testdir
[root@mail ~]# ls -l testdir
总用量 0
-rw-r--r--. 1 root testgroup 0 9月 8 19:38 test
Linux基础学习-基本命令的更多相关文章
- Linux基础学习系列目录导航
Linux基础学习-通过VM安装RHEL7.4 Linux基础学习-命令行与图形界面切换 Linux基础学习-基本命令 Linux基础学习-RHEL7.4之YUM更换CentOS源 Linux基础学习 ...
- linux基础学习之软件安装以及常用命令
linux基础学习之软件安装以及常用命令 调用中央仓库: yum install wget 然后下载nodejs: wget https://nodejs.org/dist/v10.14.2/node ...
- linux基础学习路线&review
linux基础学习网址: https://www.runoob.com/linux/linux-tutorial.html 比较重点的是这个启动过程的介绍学习:https://www.runoob.c ...
- Linux 基础学习1
目录 Linux 基础学习 用户登录 终端 交互式接口 bash 修改ssh连接慢的步骤 命令提示符 显示提示符格式 命令 别名 命令格式 获取命令的帮助信息 man bash 快捷键 tab 键 引 ...
- Linux 基础学习2
目录 Linux 基础学习2 文件目录结构 文件命名规范 文件系统结构 linux应用程序的组成 绝对路径和相对路径 目录名和基名 切换目录 切换到家目录 切换到上一次的目录 显示当前的工作目录 列出 ...
- Linux基础学习(全)
使用的Linux发行版本为Redhat 1.Linux(RedHat)基础学习-命令行使用入门 2.Linux(RedHat)基础学习-文件寻址与管理 3.Linux(RadHat)基础学习-vim编 ...
- Linux基础学习(1)--Linux系统简介
第一章——Linux系统简介 1.UNIX和Linux发展史: 1.1 unix发展史: (1)1965年,美国麻省理工学院(MIT).通用电气公司(GE)及AT&T的贝尔实验室联合开发Mul ...
- Linux基础学习笔记2-文件管理和重定向
本节内容 1)文件系统结构元素 2)创建和查看文件 3)复制.转移和删除文件 4)软和硬链接 5)三种I/O设备 6)把I/O重定向至文件 7)使用管道 文件系统和结构 文件系统 文件和目录被组织成一 ...
- Linux 基础学习(第二节)
free命令用于显示当前系统中内存的使用量信息,格式为:“free [-h]”. 为了保证Linux系统不会突然卡住宕机,因此内存使用量应该是运维人员时刻要关注的数据啦,咱们可以使用-h参数来以更人性 ...
随机推荐
- ZooKeeper-3.3.4集群安装配置(转载)
ZooKeeper是一个分布式开源框架,提供了协调分布式应用的基本服务,它向外部应用暴露一组通用服务——分布式同步(Distributed Synchronization).命名服务(Naming S ...
- c3p0连接池的简单使用和测试1
- go系列(3)- go框架beego以及redis的使用
这篇讲讲如何在beego框架使用redis. golang中比较好用的第三方开源redisclient有: go-redis 源码地址:https://github.com/go-redis/redi ...
- web前端与后台数据交互
1.前端请求数据URL由谁来写? 在开发中,URL主要是由后台来写的,写好了给前端开发者.如果后台在查询数据,需要借助查询条件才能查询到前端需要的数据时,这时后台会要求前端提供相关的查询参数,这里的查 ...
- Metasploits之ms10_018
漏洞详情:https://technet.microsoft.com/library/security/ms10-018 一准备: 1:kali Linux系统 192.168.195.129 2:W ...
- Win10系统特别卡的一个原因
我遇到的Win10特别卡的原因是它自带的一个杀毒软件 迈克菲(McAfee)导致的,在卸载之前电脑真的特别卡,打开一个窗口都卡,,卸载了之后瞬间感觉电脑飞起来了.... 当然还有很多原因会导致电脑卡, ...
- [已读]你不知道的JavaScript(上卷)
就在前幾天,我在看完第一部分的時候,說它在我心中要超過蝴蝶書了,好吧,現在要收回這句話.第二部分的內容著重在ecma5,6對象的新特性的介紹,深度上就一般啦,沒什麼收穫.總體來說,這本書詞法作用域,作 ...
- 简单的鼠标经过特效-mouse事件
<!doctype html> <html lang="zh-cn"> <head> <meta charset="UTF-8& ...
- 终端工具Xmanager使用技巧
1. 新建绘画使用终端连接服务器 2. 设置终端类型和编码 3. 设置终端外观,包括字体颜色等等 4. 设置默认上传路径和下载路径
- webpack(1)
在网页中会引用哪些常见的静态资源? JS .js .jsx .coffee .ts(TypeScript 类 C# 语言) CSS .css .less .sass .scss Images .jpg ...