定义命令别名——Alias

1.(1)

[root@localhost ~]# vim ~/.bashrc

alias hello="echo `hello,everyone` >> /file.txt"

[root@localhost ~]# hello

[root@localhost ~]# cat /file.txt

hello,everyone

hello,everyone

hello,everyone

(2)

[root@localhost ~]# vim ~/.bashrc

alias shuaxin=”echo `date` >> file.txt”

bash

shuaxin

[root@localhost ~]# cat file.txt

Tue Nov 23 22:13:57 CST 2021

Tue Nov 23 22:17:20 CST 2021

2.

[root@localhost ~]# vim /etc/bashrc

alias hh="touch file1 /home

[root@localhost ~]# bash

[root@localhost ~]# hh

[root@localhost ~]# ll

total 12

-rw-------. 1 root root 1569 Nov 20 05:42 anaconda-ks.cfg

drwxr-xr-x. 2 root root    6 Nov 20 05:45 Desktop

drwxr-xr-x. 2 root root    6 Nov 20 05:45 Documents

drwxr-xr-x. 2 root root    6 Nov 20 05:45 Downloads

-rw-r--r--. 1 root root    0 Nov 23 22:25 file1

3.

[root@localhost ~]# groupadd shengchan

[root@localhost ~]# groupadd caiwu

[root@localhost ~]# groupadd jishu

4.

[root@localhost ~]# useradd wjx -G shengchan

[root@localhost ~]# useradd liuy -G caiwu

[root@localhost ~]# useradd zxx -G jishu

修改密码

[root@localhost ~]# useradd admin

[root@localhost ~]# passwd admin

Changing password for user admin.

New password:

BAD PASSWORD: The password is shorter than 8 characters

Retype new password:

passwd: all authentication tokens updated successfully.

你可能感兴趣的:(网络)