Using bash
tar -xf archive.tar -C /path/to/directory
where:
-x
= extract-f
= file option input specifying location-C
= file option output specifying location
Using grep
to search files and folders in a directory recursively:
grep -rni "string" *
where
r
= recursive i.e, search subdirectories within the current directoryn
= to print the line numbers to stdouti
= case insensitive search
See this post on StackOverflow.
apt search package_name
mv
is used to move and rename files/directories, usage:
mv [OPTIONS] SOURCE DESTINATION
diff -r <directory1> <directory2>
grep -Rnw '/path/to/somewhere/' -e 'pattern'
Adding -l
option provides file name containing result. See this StackOverflow post
To display connected hard disks, mount points, etc
lsblk
Create a folder to mount:
sudo mkdir /media/disk
Then use mount:
sudo mount /dev/sda1 /media/disk
Use ntfsfix
, which is part of ntfs-3g
.
Make sure disk is not mounted:
umount /dev/sda1
Then run nftsfix
on disk:
sudo ntfsfix /dev/sda1
Be cautious, MS Windows utilities should be preferred.
ps
shows a list of running processes.
Article here details some of the switches, etc.
top
provides a real-time list of running processes in order of CPU usage.