Find top/largest files and directories on a Linux server 1

Find top/largest files and directories on a Linux server

To find the largest files and directories on a linux server, type the command bellow… and grab a cup of coffee afterwards. Change head -n $top_num to your liking to get the top x files and/or directories.

 

Ubuntu 18.04 disable predictable network names 2

Ubuntu 18.04 disable predictable network names

Cloud-init doesn’t work with predictable network names … So In favor of cloud-init automated network set up disable them. In: /etc/default/grub Change to: GRUB_CMDLINE_LINUX=”net.ifnames=0 biosdevname=0″ source

Find files or directories owned by user/group and permission bits 3

Find files or directories owned by user/group and permission bits

Find files or directories owned by user/group and permission bits   Find all files not owned by user

  Find all files not owned by group

Find all files that don’t have specific permissions

  Examples: Find all files that don’t have 755 permissions

Combine all parameters: Find all python files […]

Find and Delete log files on a linux system 4

Find and Delete log files on a linux system

Find and Delete log files on a linux system. Think before you act.

 

Mount disk and install grub boot loader 5

Mount disk and install grub boot loader

Mount disk and install grub boot loader

 

Delete all lines of a file containing a regex pattern using sed 6

Delete all lines of a file containing a regex pattern using sed

Delete all lines of a file containing a regex pattern using sed. For example you can delete all commented lines of a default configuration file. Take a look on my basic regex cheat sheet  

 

Replace a string with a new one in all files using sed and xargs 7

Replace a string with a new one in all files using sed and xargs

Replace a string with a new one in all files using sed and xargs

     

comment specific line using sed command 8

comment specific line using sed command

Comment specific line using sed command can be used to configuration files …

 

Import large .sql file into MySQL database 9

Import large .sql file into MySQL database

Should be used for really huge database imports like tens of GB … Note: remember to navigate to the directory where your .sql file lives so you can use source on it later …

Note: if you’re not sure what these options do, please, do some research  first.

   

Search inside tarball on Linux 10

Search inside tarball on Linux

Searching inside a tarball file (even gzipped) can be really relieving. You don’t have to extract all the files every time to seek for a file using find command. Search tarball files using grep

Search tarball files using its built-in parameter Note: that if you want to use wildcards you need to add –wildcards […]