Как отображать только имена файла [закрыто]

Deberá restablecer la marca de tiempo en el directorio después de eliminar los archivos. Suponiendo herramientas GNU,algo como esto debería funcionar:

mtime=$(stat -c %y dir)            # get the timestamp, store in $mtime
rm dir/somefile dir/someotherfile  # do whatever you need
touch -d "$mtime" dir              # set the timestamp back

Eso restablece las marcas de tiempo de modificación(mtime)y acceso(atime)en el directorio a la marca de tiempo de modificación original, pero también establece la marca de tiempo de cambio(ctime)a la hora actual. Cambiar el ctimees inevitable, pero probablemente no le importe o atime.

-3
21.03.2019, 03:12
3 ответа

Вы можете использовать следующую команду.

ls -ltr | tail
-2
28.01.2020, 05:19
tail -n 10 /etc/services | cut -f 1 -d " "
1
28.01.2020, 05:19

Другой способ:

awk -F' ' 'NF=1' /etc/services |tail -n 10

или

awk -F' ' '{print $1}' /etc/services |tail -n 10

0
28.01.2020, 05:19

Теги

Похожие вопросы