Skip to content

Instantly share code, notes, and snippets.

- name: Get file size
hosts: your_host
- name: Check file size
path: /path/to/your/file
register: file_info
- name: Display file size

find command:

Use find command, find all *.txt files but ignore foo.txt

find . -type f ( -iname "*.txt" ! -iname "foo.txt" )

To delete file add -delete or -exec your-delete-command-here option.

find . -type f ( -iname "*.txt" ! -iname "foo.txt" ) -delete

To select folder or dirs use -type d, in this example, find all folders and ignore foo and bar folder :

find . -type d ( ! -iname "foo" ! -iname "bar" )

To delete folders except foo and bar

find . -type d ( ! -iname "foo" ! -iname "bar" ) -execdir rm -rfv {} +

Be careful while deleting files and dirs.

To check the size of a directory in Ubuntu, you can use the du command. This command stands for "disk usage" and it shows the amount of disk space used by the specified files or directories.


-h , --human-readable

-s, --summarize

-a, --all

Today we can discuss about IP address and I can also tell you about IPv4 and IPv6: Everyone who are living in this world has it’s own unique identity. The unique identity maybe his/her home address or maybe his/her ID card number. But can you ever think what is your identity on the internet??? So, don’t worry today i can answer this question in more simple words.

IP Address:

IP address stands for Internet Protocol Address. It can provide your identity on the internet.

It’s also enable the devices to communicate with each other on IP Based Networks like internet. The example of IP address is (231.23.764.123).

The working process of this technology is very simple. When any device is connected to the internet. A unique numerical identity is assigned to it. When two devices wanted to share the information.

Question: What is the most efficient way to configure an IP address on a Linux system with multiple network interfaces?

Answer: The most efficient way to configure an IP address on a Linux system with multiple network interfaces is to use the Network Manager utility.

This tool allows you to easily set up and manage your network connections on a Linux system, including assigning static IPs to multiple interfaces.

It can also be used for troubleshooting networking related issues, such as diagnosing problems with DHCP servers or configuring VPNs.

Get current time with python time module

import time
Mon Apr 13 23:30:38 2020

Get current time with python datetime module

how to get last element of a list in python

list1 = [1, 2, 3, 4, 5]

Example 1

#a list

cars = ['Ford', 'Volvo', 'BMW', 'Tesla']

#append item to list





list=["my","name","is","mark","age",18] print("添加前:",list) list.append("test") print("添加后:",list) 打印结果: