User Tools

Site Tools


files_and_directories

If you want to send us your comments, please do so. Thanks
More on comments


Files and directories

Commands

CommandExplanation
chmod
cmpCompare two files byte by byte
Copy
ddConvert and copy a file
ddptCopies data between files and storage devices
diffCompare files line by line
dircolorsColor setup for ls
fdupesFind duplicate files
flockManage locks from shell scripts
grep
lsList the contents of a directory
lsdvdRead the content info of a DVD
mkdirmkdir -p $HOME/.anacron/{etc,spool} ; Create a directory and two sub directories in it
Move
nnn
Searching
statDisplay file or file system status (blocks, inodes)
treeShow a direcory and file structure in color

nnn

Man page: nnn The missing terminal file manager for X

  • Needs mediainfo to show info about media (m and M key)
  • Search, find, goes with filters.
    • Enter a / to start the filter
    • Works with “^” and “&” (filter from the beginning of the filename or the end. If not given, filter anywhere in the filename)
    • Exit the filter:
      • If you did not scroll: This can be achieved by entering Backspace until the / has vanished (one more Backspace moves one directory up (if any))
      • If you did scroll (down and up arrows): type / again and then Backspace once

stat

Examples
stat --file-system /home

  File: "/home"
    ID: hash Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 7526644    Free: 3521561    Available: 3133465
Inodes: Total: 1921360    Free: 1796884

stat --file-system --terse /home

/home hash 255 ef53 4096 4096 7526644 3521561 3133465 1921360 1796886

stat .bashrc

  File: .bashrc
  Size: 576      	Blocks: 16         IO Block: 4096   regular file
Device: 1111/2222d	Inode: 530518      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/     user)   Gid: ( 1000/     user)
Access: 2020-05-12 15:42:21.424577990 +0000
Modify: 2019-02-20 13:32:25.117112973 +0000
Change: 2019-02-20 13:32:25.149112509 +0000
Birth: -

stat --terse .bashrc

.bashrc 576 16 3333 1000 1000 807 530518 1 0 0 1589298141 1550669545 1550669545 0 4096

stat --format %F somefile.txt

symbolic link

If the file is a symbolic link otherwise it can be

regular file

or

directory

locked files and directorys

To check if a directory is locked. Examples

fuser --verbose --mount /mnt/somedirectory
dmsetop [dep | info | status |table] somedirectory

Prevent acidental directory deletion

Do

  • Make sure the files you need are in the directory
  • chmod 555 directory

Now you can still read and edit the files but not delete the directory nor the files
If you want to add or delete files you need to do chmod 755 directory first and afterwards put it back to 555

Getting CD's or DVD's

Using jigdo can save you time and the server owner cpu cycles and bandwidth

To get the first 3 DVD's of Debian 9.3.0 amd64 mount older the CD and / or DVD iso's you already have with

mkdir /mnt/isomount.x (x starting form 1 until the amount of iso's you have)
mount -o loop isoyoualreadyhave.iso /mnt/isomount.x

and then do

for i in {1..3}; do wget https://cdimage.debian.org/cdimage/archive/9.3.0/amd64/jigdo-dvd/debian-9.3.0-amd64-DVD-$i.jigdo; done
for i in {1..3}; do wget https://cdimage.debian.org/cdimage/archive/9.3.0/amd64/jigdo-dvd/debian-9.3.0-amd64-DVD-$i.template; done
for i in {1,2,3}; do jigdo-lite debian-9.3.0-amd64-DVD-$i.jigdo; done

and follow the, read them well, instructions


Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy

RSS
Disclaimer
Privacy statement
Bugs statement
Cookies
Copyright © : 2014 - 2022 Webevaluation.nl and the authors
Changes reserved.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
files_and_directories.txt · Last modified: 20-06-2022 17:00 by wim