Shell/Bash在线运行

所属目录
点击了解高性能代码运行API
运行结果
教程手册
代码仓库
极速运行
交互输入
极速运行模式,更高效的运行,点击编辑器上方的运行按钮即刻体验吧。
以下是用户最新保存的代码
# 命令替换 有两种方法: - 方法一:`command` - 方法二:$(command) 总结: - ``和$()两者是等价的,但推荐初学者使用$(),易于掌握;缺点是极少数UNIX可能不支持,但``都是支持的 - $(())主要用来进行整数运算,包括加减乘除,引用变量前面可以加$,也可以不加$ 发布于:2023-03-17 21:48 awk的for循环和二维字典和printf实现二维数据表倒置 发布于:2023-03-15 23:34 # 变量替换 ## 字符串处理 ### 字符长度 1. ${#string} 2. `expr length "$string"` ### 获取字符串索引位置 1. expr index "$string" substr ### 获取子串长度 1. expr match "$string" substr ### 抽取子串 方法一: 1. ${string:position} 2. ${string:position:length} 3. ${string: -position} 或者 ${string:(position)} 方法二: 1. expr substr $string $position $length 注意:使用expr,索引计数是从1开始计算;使用${string:position},索引计数是从0开始计数 发布于:2023-03-17 21:33 for 循环用法 发布于:2023-03-15 03:47 测试测试测试测试测试测试测试 发布于:2023-03-14 10:48 #echo,xargs,sort,uniq,awk命令实现word.txt统计word次数 发布于:2023-03-14 10:47 工业互联网日报 发布于:2023-03-06 12:52 初次使用shell测试 发布于:2023-03-04 21:31 while 循环123 发布于:2023-03-01 22:48 检测两台服务器指定目录下的文件一致性 发布于:2023-02-27 21:22 增加新的判断条件并且兼容没有设置过判断参数的项目 发布于:2023-02-24 16:03 REDIS监控 发布于:2023-02-27 09:18 shell脚本1 发布于:2023-02-21 15:08 测试shell 发布于:2023-01-31 09:46 支持库安装 发布于:2022-12-29 12:15 测试软件服务是否安装并确认是否安装 发布于:2022-12-28 14:56 自定义函数 发布于:2022-12-27 10:49 read读取控制台输入 read (选项)(参数) 发布于:2022-12-27 09:14 while循环 while [ 条件判断式 ] do 程序 done 执行结果不对,为啥呢 发布于:2022-12-26 17:49 for循环 语法二 for 变量 in 值1 值2 值3... do 程序 done 发布于:2022-12-26 17:30 for循环 发布于:2022-12-26 17:16 shell脚本测试! 发布于:2022-12-20 17:25 for字符写三行值 发布于:2022-12-19 10:49 求最大值。 发布于:2022-12-19 10:48 Shell 基础知识 发布于:2022-12-06 00:41 【Shell】测试read功能,注意两次的输入要有回车 发布于:2022-12-01 20:15 【Shell】此段代码为shell if else测试代码 发布于:2022-12-01 20:16 the number of dirctary is 13 the number of file is 16 发布于:2022-11-30 00:27 bash-测试表清理 发布于:2022-11-28 18:09 设计一个任意输入一个数,判断这个数是不是质数 发布于:2022-11-26 18:02 shell判断解压 发布于:2022-11-24 16:49 九九乘法表 发布于:2022-11-07 17:39 字符类型判断 发布于:2022-11-07 21:45 12 编写shell脚本,执行后,打印一行提示“Please input a number.”逐次打印用户输入数值,直到用户输入“end”为止。 发布于:2022-10-24 21:42 程序建立三个以输入日期为名称的文件. 发布于:2022-07-12 15:19 用户输入姓氏和名字,系统输出姓名 发布于:2022-07-12 15:01 相隔某数倍数进行打印 发布于:2022-05-25 10:21 工作测试代码 发布于:2022-05-16 14:10 shell基础语法 发布于:2022-04-11 18:29 shell脚本 发布于:2022-01-20 15:56 sssasdfsad asdf asdfa 发布于:2021-10-08 17:10 在线Shell体验 发布于:2021-08-11 09:50 在线shell体验 发布于:2021-08-11 09:45 #输入一个数字,并显示出来。 发布于:2021-08-05 17:05 r_daily_new_clue_d.sh 发布于:2021-07-22 20:34 shell脚本测试 发布于:2021-07-20 20:02 查找局域网内可ssh登录的主机(22端口) 发布于:2021-07-14 18:03 dns setting for macOS 发布于:2021-06-22 14:54 不用date编写计算时间的脚本 发布于:2021-05-23 14:11 第一个shell程序 发布于:2021-05-09 16:12 [更多]
显示目录

finger命令 – 查询其他使用者的资料



finger命令

finger命令可以让使用者查询一些其他使用者的资料。会列出来的资料有:

Login Name、 User Name、 Home directory、 Shell、 Login status、 mail status、 .plan、 .project、 .forward

其中 .plan、.project 和 .forward 就是使用者在他的 Home Directory 里的 .plan , .project 和 .forward 等档案里的资料。如果没有就没有。finger 指令并不限定于在同一服务器上查询,也可以寻找某一个远端服务器上的使用者。只要给一个像是 E-mail address 一般的地址即可。

使用权限:所有使用者。

语法

finger [options] user[@address]

参数

-l   多行显示。
-s   单行显示。这个选项只显示登入名称、真实姓名、终端机名称、闲置时间、登入时间、办公室号码及电话号码。如果所查询的使用者是远端服务器的使用者,这个选项无效。

实例

列出当前登录用户的相关信息

# finger -l //显示用户信息
Login: root Name: root
Directory: /root Shell: /bin/bash
On since Fri Apr 9 20:17 (CST) on :0 (messages off)
On since Fri Apr 9 20:17 (CST) on pts/1 32 days 22 hours idle
On since Fri Apr 9 20:17 (CST) on pts/3 4 hours 5 minutes idle
(messages off)
On since Wed May 12 18:08 (CST) on pts/4 from 192.168.1.10
On since Wed May 12 18:35 (CST) on pts/5 from 192.168.1.10
7 minutes 54 seconds idle
On since Wed May 12 14:37 (CST) on pts/2 from 192.168.1.10
3 hours 14 minutes idle
On since Wed May 12 14:53 (CST) on pts/7 34 minutes 25 seconds idle
(messages off)
On since Wed May 12 16:53 (CST) on pts/8 from 192.168.1.10
30 minutes 18 seconds idle
Mail last read Mon Mar 31 04:02 2008 (CST)
No Plan.

显示指定用户信息

# finger -m hnlinux

显示远程用户信息

# finger -m root@192.168.1.13

下列指令可以查询本机管理员的资料:

finger root

其结果如下:

Login: root Name: root
Directory: /root Shell: /bin/bash
Never logged in.
No mail.
No Plan.
由JSRUN为你提供的Shell/Bash在线运行、在线编译工具
        JSRUN提供的Shell/Bash 在线运行,Shell/Bash 在线运行工具,基于linux操作系统环境提供线上编译和线上运行,具有运行快速,运行结果与常用开发、生产环境保持一致的特点。