$ sudo apt update
$ sudo apt -f install
$ sudo apt full-upgrade
$ sudo apt install gimp
sudo apt update
sudo apt -f install
sudo apt full-upgrade
sudo apt install gimp
gimp
, as one can guess.Renaming a specific file
$ rename ....
Append .txt
to all files
$ rename -a ".txt" *
$ ls
my-file-1.txt my-file-2.txt my-file-3.txt my-file-4.txt
Prepend my-
to all files
$ rename -A "my-" *
$ ls
my-file-1 my-file-2 my-file-3 my-file-4
Substitute —
with _
in all occurrences using the -S
option
$ rename -S "-" "_" *
my_file_1.txt my_file_2.txt my_file_3.txt my_file_4.txt
Find all files recursively using the find
command in the current directory
$ find . -name "foo*"
Delete Directory
$ sudo rm -r /path/to/folderName
Note: The parameter letters of -f
, -r
, -v
can be used together (-rf
no spaces) or separately:
-f
to ignore non-existent files, never prompt-r
to remove directories and their contents recursively-v
to explain what is being doneAnother simplified method of deleting a diretory
$ rmdir /path/to/folderName
Copying example.txt into Documents
$ cp example.txt ~/Documents
Copy into a new file name (similar to mv
)
$ cp example.txt ~/Documents/file.txt
Copy a folder (--verbose
shows details and is not needed)
cp -r --verbose Documents NewDocuments
Moving a file
$ mv example.txt file.txt
$ mv example.txt ~/Documents/file.txt
To prevent a file from being overwritten without warning use --interactive
(or -i
for short)
$ mv -i example.txt ~/Documents
Find machine IP Address
$ ifconfig -a
List active applications and their listening interface and port number
$ sudo netstat -tlnp
Returns all the elements of a JSON
$ curl https://jsonplaceholder.typicode.com/users | jq '.[]'
Returns the first element of a JSON
$ curl https://jsonplaceholder.typicode.com/users | jq '.[0]'
Returns only the name (in company object) property of the first element
$ curl https://jsonplaceholder.typicode.com/users | jq '.[0] | {name: .company.name}'
Returns only the name AND lat (different objects) properties of the first element
$ curl https://jsonplaceholder.typicode.com/users | jq '.[0] | {name: .company.name, lat: .address.geo.lat}'