Posts Tagged With: file

SCP Copy from Remote to Local System

Tagged with: , , , , , ,

Copy files/folder from a remote server to this system.


scp -r binnyva@192.168.0.100:/home/binnyva/folder_to_copy . 
No Comments »

Copy Files using SCP

Tagged with: , , , , , , ,

Copy files/folder to a remote server.


scp <file> binnyva@192.168.0.100:/home/binnyva/
scp -r <folder> binnyva@192.168.0.100:/home/binnyva/
No Comments »

List of Open Files

Tagged with: , , , , , , ,

Display a list of files opened by processes


lsof -p NUMBER
1 Comment »

Find Open File in a Given Directory

Tagged with: , , , , , , , , ,

Find the process that’s opened the file from a specified directory. You can use this if you cannot unmount a USB drive and want to know which file is open.


lsof +D /media/usb

Original Article

1 Comment »

Write and Append Permission

Tagged with: , , , ,

Allows write opening of a file only append mode


chattr +a file
No Comments »

Compare contents of two files

Tagged with: , , , , ,

Compare contents of two files by deleting only unique lines from ‘file1’


comm -1 file1 file2
No Comments »

Copy all Txt Files

Tagged with: , , , , , ,

Find and copy all files with ‘.txt’ extention from a directory to another


find /home/binnyva -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents
No Comments »

Sort and Unique

Tagged with: , , , , , ,

Sort contents of a file and remove repeated lines


sort file.txt | uniq
1 Comment »

View some lines in a file

Tagged with: , , , ,

View from 1th to 5th line


sed -n '1,5p;5q' example.txt
No Comments »

Encrypt/Decrypt using GPG

Tagged with: , , , ,

Encrypt/Decrypt a file with GNU Privacy Guard – GPG.


#Encrypt
gpg -c file

#Decrypt
gpg file.gpg
1 Comment »