Menade du?Filändelser är för att visa vad filen innehåller och hur den ska läsasTrafik är samspelet mellan fordonUppdaterad 2025-01-21
Filer
EOF - end-of-file
LFS - Large File Storage
fa-file
fa-file-o
Checksums för filer
Kryptering
Fil
Linux
Mac
Windows
MD5 file .md5
md5sum file
md5 file
certUtil -hashfile file MD5
SHA-1 file .sha1
sha1sum file
shasum -a 1 file
certUtil -hashfile file SHA1
SHA-256
file .sha256sha256sum file
shasum -a 256 file
certUtil -hashfile file SHA256
SHA-512
file .sha512sha512sum file
shasum -a 512 file
certUtil -hashfile file SHA512
Skapa en fil i UNIX
touch file
find . -name filename
Gör en fil som heter imgcat körbar i terminalen med UNIX
chmod +x imgcat
Visa hierarki för filer i DOS
TREE
Visa innehållet i en fil i DOS
PRINT
MOVE
Kopiera med DOS
COPY
Ta bort en fil i DOS
DEL
Byt namn på en fil i DOS
REN
RENAME
Byt ut en fil i DOS
REPLACE
Jämför filer i DOS
COMP
FC
Sök efter filer i DOS
FIND
FINDSTR
Visa vilket sätt filer förs över på med FTP (ASCII /binary )
type
$_FILES
<input type="file">
Delar
Rättigheter
# Permission rwx
7 read, write and execute rwx
6 read and write rw-
5 read and execute r-x
4 read only r--
3 write and execute -wx
2 write only -w-
1 execute only --x
0 none ---
Rättigheter
No permissions (---
)
Execute only (rare) (--x
)
Write only (rare) (-w-
)
Write and execute (rare) (-wx
)
Read only (r--
)
Read and execute (r-x
)
Read and write (rw-
)
Read, write, and execute (rwx
)
Version av file
file --version
Vilken file?
which file
Sökväg
/usr/bin/file
Visa hur många radbrytningar finns i en fil
cat file | wc -l
ls folder | wc -l
gzip -cr folder file.gz
.ssh/authorized_keys
Flagga som används för att endast visa namn på filer som har ändrats för en commit i Git
git show --name-only --oneline c532ebd24ee2ecb259f9a45bc111fc588216879b
function openFile() {
document.getElementById('inp').click();
}
function readFile(e) {
var file = e.target.files[0];
if (!file) return;
var reader = new FileReader();
reader.onload = function(e) {
document.getElementById('contents').innerHTML = e.target.result;
}
reader.readAsText(file)
}
formData = new FormData();
formData.append("thefile", file);
xhr.send(formData);
file();
file_exists();
file_get_contents();
file_put_contents(, );
fileatime();
filectime();
filegroup();
fileinode();
filemtime();
fileowner();
fileperms();
filesize();
filetype();
Ta emot fil med PHP
$_FILES['example.txt']
Ta reda på om en fil finns med PHP
file_exists('example.txt')
Hämta innehåll från en lokal fil
file_get_contents('example.txt')
Hämta innehåll från en extern fil
file_get_contents('http://example.com')
Tid för när en fil sparades med PHP
filemtime('example.txt')
Funktion för att visa alla filer i nuvarande mapp med PHP
scandir()
Read a file with PHP
$my_file = 'file.txt';
$handle = fopen($my_file, 'r');
$data = fread($handle,filesize($my_file));
Write to a file with PHP
$my_file = 'file.txt';
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file);
$data = 'This is the data';
fwrite($handle, $data);
Append to a file with PHP
$my_file = 'file.txt';
$handle = fopen($my_file, 'a') or die('Cannot open file: '.$my_file);
$data = 'New data line 1';
fwrite($handle, $data);
$new_data = "
".'New data line 2';
fwrite($handle, $new_data);
Close a file with PHP
$my_file = 'file.txt';
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file);
//write some data here
fclose($handle);
Delete a file with PHP
$my_file = 'file.txt';
unlink($my_file);
Exempel på hur man gör för att en fil ska få tillåtelse att öppna andra filer med hjälp av flaggan --allow-file-access-from-files
på DOS
start "C:\Program Files\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files
⌘N Nytt fil
⌘O Öppna fil…
⌘W Stäng fil
⌘S Spara fil…
⌘J Filhämtaren
⌘ + ⇧ + .
win.loadFile('index.html')