[Linux][Python]How to assign os.system output to a python variable


#This python script is to get  system’s VGA  monitor info import commands command = “lspci | grep VGA ” status, vgaInfo = commands.getstatusoutput(command) print “VGA info=%s” % ( vgaInfo ) which will give the output VGA info=00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 18) in my system

[Shell Script]How to execute multiple shell commands using a single shell variable ?


To execute multiple shell commands using a single shell variable,Assign the multiple shell commands to a variable.execute the shell variable using echo eg:Find a.txt in the present directory Let the multiple commands are ls and grep Let the shell variable is cmd .cmd=$(ls | grep a.txt )To execute the commands ,echo $cmd cmd=$(ls | grep test.txt)   

[Linux][Commands]How to find files by its size in a directory


find dir_name  -size  50M   –> This command is for finding files with size 50MB find dir_name  -size  -50M   –> This command is for finding files with size smaller  than 50MB find dir_name -size +50M   –> This command is for finding files with size bigger than 50MB   where the dir_name is theContinueContinue reading “[Linux][Commands]How to find files by its size in a directory”

[Linux]How to create parent directories as needed with one command


mkdir -p dir1/dir2/dir3 This command will create a sub directory ,dir3 , inside dir2, which is the sub directory of parent directory,  dir1

[Linux]how to copy all the files of same format from a directory which is having multiple direcotries inside, to another location


how to copy all the files of same format from a directory ,which is having multiple directories inside, to another location cp `find -name *.txt` Loc_to_copy where Loc_to_copy is the location to copy .

Design a site like this with WordPress.com
Get started