linux代码训练,Linux练习命令一

1.clock 和hwclock的用法

[root@localhost ~]# clock --help

hwclock - query and set the hardware clock (RTC)

Usage: hwclock [function] [options...]

Functions:

-h | --help         show this help

-r | --show         read hardware clock and print result

--set          set the rtc to the time given with --date

-s | --hctosys      set the system time from the hardware clock

-w | --systohc      set the hardware clock to the current system time

--systz        set the system time based on the current timezone

--adjust       adjust the rtc to account for systematic drift since

the clock was last set or adjusted

-c | --compare      periodically compare the system clock with the CMOS clock

--getepoch     print out the kernel's hardware clock epoch value

--setepoch     set the kernel's hardware clock epoch value to the

value given with --epoch

-v | --version      print out the version of hwclock to stdout

Options:

-u | --utc          the hardware clock is kept in UTC

--localtime    the hardware clock is kept in local time

-f | --rtc=path     special /dev/... file to use instead of default

--directisa    access the ISA bus directly instead of /dev/rtc

--badyear      ignore rtc's year because the bios is broken

--date         specifies the time to which to set the hardware clock

--epoch=year   specifies the year which is the beginning of the

hardware clock's epoch value

--noadjfile    do not access /etc/adjtime. Requires the use of

either --utc or --localtime

--adjfile=path specifies the path to the adjust file (default is

/etc/adjtime)

--test         do everything except actually updating the hardware

clock or anything else

-D | --debug        debug mode

hwclock –s 同步硬件时间到系统时间

hwclock –w 同步系统时间到硬件时间

hwclock –r 显示当前硬件时间状态

50e3459be4cf6b50e6c08a03770d110f.png

2.cd 进入指定目录

cd / 直接跳转到根目录

cd  etc 或cd /etc进入 根目录下的etc目录 前一个是相对路径,后一个是绝对路径

cd .. 返回上一级目录

3cal 调出日历

CAL(1)

NAME

cal - display a calendar

SYNOPSIS

cal [options] [[[day] month] year]

cal 显示当前日历

cal year 显示所属年份日历

cal  -s 本月日历按Sunday列出

cal –m 本月日历按Monday列出

4. pwd 显示当前工作目录 命令行下直接pwd

5. ls

NAME

ls - list directory contents

SYNOPSIS

ls [OPTION]... [FILE]...

ls:list

列出指定路径下的文件或目录的属性信息

Metadata:属性数据

data:数据

ls [OPTION]... [FILE]...

-l: 使用长格式显示

drwxr-xr-x 1 root root    8 Aug 23 08:47 .cache

d: 文件类型

rwxr-xr-x:权限,mode

1:文件被硬链接的次数

root: owner,属主;

root: group, 属组

8:size,默认为字节

Aug 23 08:47 修改时间戳

.cache:文件名

-d:显示目录自身属性

-h: human-readable

-a:显示所有文件,包括.开头的隐藏文件

.: 当前目录

..: 父目录

-r: reverse,逆序显示

-R: recusive,递归

3ac571ef6acf348367bf8339c3db1471.png

6.which 和whereis

查找shell命令路径,但是whereis 会给出帮助文件路径

9e8c0b225808b2648f559f7111923122.png

stat

stat –f file 显示文件状态

47c922d27af8ddf347c60729fd302da8.png

echo 回显命令

echo [SHORT-OPTION]... [STRING]...

echo LONG-OPTION

DESCRIPTION

Echo the STRING(s) to standard output.

-n     do not output the trailing newline

-e     enable interpretation of backslash escapes

-E     disable interpretation of backslash escapes (default)

--help display this help and exit

echo -e 你好 '\n' 回显你好,并让换行符生效

echo -n nihao  不进行换行

454299ac2d18e07097c7ce1bee411c78.png

w who 和whoami

w 显示谁登录和系统 并且在做什么

who 显示登录系统的用户 那种终端登陆 以及登录的时间和登录地址

whoami 显示登录系统的用户

shutdown,halt,poweroff 系统关机命令

reboot 系统重启命令

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值