To use the who command to find the current user account, you can use the who command with the awk argument and assign it to a variable as shown here: #!/bin/bash # Get the current user account using who and awk current_user=$(who | awk '{print $1}') echo "The current user is...
-mtime days:按修改时间查找,支持使用+或-表示在指定天数前或后,days 是一个整数表示天数。 -user username:按文件所有者查找。 -group groupname:按文件所属组查找。 动作:可选的,用于对匹配到的文件执行操作,比如删除、复制等。 find 命令中用于时间的参数如下: -amin n:查找在 n 分钟内被访问过的文件。
find./ \( -name'tmp'-xtype c -user'inin'\) 常用动作 -exec 命令名称 {} 对符合条件的文件执行所给的Linux 命令,而不询问用户是否需要执行该命令。{}表示命令的参数即为所找到的文件;命令的末尾必须以“ \;”结束。-ok 命令名称 {} 对符合条件的文件执行所给的Linux 命令,与exec不同的是,它会询问...
find /home -used -2 列出文件或目录被改动过之后,在2日内被存取过的文件或目录 find /home -user cnscn 列出/home目录内属于用户cnscn的文件或目录 find /home -uid +501 列出/home目录内用户的识别码大于501的文件或目录 find /home -group cnscn 列出/home内组为cnscn的文件或目录 find /home -gid ...
find ~ -user sam –print 在$HOME目录中查找文件属主为sam的文件 -group 按照文件所属的组来查找文件。 find /apps -group gem –print 在/apps目录下查找属于gem用户组的文件 -mtime -n +n 按照文件的更改时间来查找文件, - n表示文件更改时间距现在n天以内,+ n表示文件更改时间距现在n天以前。
Linux operating system has made everything very simple. It doesn’t stick the user with one approach as a single function can be performed in multiple ways. It is necessary to find your ID when you give access to other people. In this case, a single pc h
Show Current Logged in Users in Linux 8. who Command – Show Information Of Currently Logged-In Users Thewhocommand is used to display users who are logged on to the system, including the username, terminal, login time, and remote host from which the user is logged in. ...
For example, find a file namedtest1.txtin your home directory with: find ~ -name "test1.txt" This command searches the current user's directory (~) for any file namedtest1.txt Find Files by Approximate Name To find files with names that approximately match a given pattern, use thefind...
How to find the UID of a user in Linux? You can always rely on the /etc/passwd file to get the UID of a user. That’s not the only way to get the UID information in Linux. Theid command in Linuxwill display the UID, GID and groups your current user belongs to: ...
fd is a program to find entries in your filesystem. It is a simple, fast and user-friendly alternative to find. While it does not aim to support all of find's powerful functionality, it provides sensible (opinionated) defaults for a majority of use cases. Installation • How to use ...