Main Menu

Search

Showing posts with label Remove. Show all posts
Showing posts with label Remove. Show all posts

LINUX: How To Remove & Reload Particular Network Bond on Linux Hosts?

Below are steps for removing and reloading particular network bond on Linux hosts

1. Bring down the network bond using below command. Replace bondX with the bond number you want to remove and reloading.

ifdown bondX

2. Run below command to remove the bonding during the runtime. This command just removes the loaded bonds during runtime, it does not complete remove the bonds.
modprobe -r bonding

3. Bring up the network bond again using below command. Replace bondX with the bond number.

ifup bondX

Products to which Article Applies

All Linux Operating Systems

Additional Reference

https://wiki.linuxfoundation.org/networking/bonding

 

LINUX: How To Remove/Ignore/Not Display Blank Lines in A File Using AWK command

Below awk command can be used for removing/ignoring and not displaying blank lines in a file.
awk /./  <filename>

Products to which Article Applies

All Linux Operating Systems

LINUX: How to Remove/Ignore/Not Display Blank Lines in A File Using grep command

Below grep command can be used for removing/ignoring and not displaying blank lines in a file.
grep -v -e '^$'  <filename>

Products to which Article Applies

All Linux Operating Systems

LINUX: How To Cleanup (Delete) Leftover Open File Descriptors Corresponding to Deleted Files in Linux? ("lsof" command)

Below steps can be followed to check and cleanup leftover open File descriptors corresponding to deleted files in Linux.

1) Check for the Leftover file descriptors in deleted status and PID using them using below command.

lsof -nP | grep '(deleted)'

As an example lets assume we see below output.

  # lsof -nP | grep '(deleted)'
bash      18044      root  cwd   unknown               0,23                    /app/server/bin (deleted) (10.10.10.30:/export/common/apps/)

In this example the file descriptor is on /app/server/bin file which no longer exists. PID 18044 is holding that descriptor.

3) Kill the PID holding leftover file descriptor kill -9 command as follows:

kill -9 <PID>

Here PID is the PID from above step 1, in this example 18044.

If the PID is of a app instance or some program process which can be gracefully shutdown, you can even shutdown the process gracefully using the related shutdown commands or scripts.

4) Verify that leftover File Descriptors in deleted status are cleaned using below command.

 lsof -nP | grep '(deleted)'

Products to which Article Applies

All Linux Operating Systems



LINUX: How to Find Empty Files and Directories in Linux and Remove Them? ("find" command)

FIND EMPTY DIRECTORIES
Below is command to find empty directories in current directory in Linux.

find . -type d -empty

If you want to find the empty directories in whole filesystem below command can be used.



find / -type d -empty 2>/dev/null

For finding and removing the Empty Directories below command can be used.

find . -type d -empty -exec rmdir {} \;

FIND EMPTY FILES

Below is command to find empty files in Linux.
find . -type f -empty

If you want to find the empty directories in whole filsystem below command can be used.

find / -type f -empty 2>/dev/null

For finding and removing the Empty Directories below command can be used.


find . -type f -empty -exec rm -f {} \;

Products to which Article Applies


All Linux Environments

Additional References
https://www.thegeekstuff.com/2010/03/find-empty-directories-and-files/