Search Results for: ftp

Absolute path vs relative path in Linux/Unix

One of this blog follower asked us that what’s the difference between absolute and relative path? To understand this we have to know what is a path in Linux. What is a path? A path is a unique location to a file or a folder in a file system of an OS. A path to a file is a combination of / and alpha-numeric characters. What is an absolute path? An absolute path is defined as the specifying the location of a file or directory from the root directory(/). In other words we can say absolute path is a complete path from start of actual filesystem from / directory. Some examples of absolute path: /var/ftp/pub /etc/samba.smb.conf /boot/grub/grub.conf If you see all these paths started from / directory which is a root directory for every Linux/Unix machines. What is the relative path? Relative path is defined as path related to the present working directory(pwd). Suppose I am located in /var/log and I want to change directory to /var/log/kernel. I can use relative path concept to change directory to kernel changing directory to /var/log/kernel by using relative path concept. pwd /var/log cd kernel Note: If you observe there is no / before kernel which indicates it’s a relative directory to present working directory. Changing directory to /var/log/kernel using absolute path concept. cd /var/log/kernel Note: We can use an absolute path from...

Read More

Learn Linux/Unix Find command with 60+ Practical examples Part-II

Advanced finds command usages Playing with basics find command options For basic Linux Find command usage please click here . Example 31: Find all the files which are with more than size 100MB and less than 1GB and the owner of the file is xyz and the file name is Adda.txt in /red folder. find /red -size +100M -size -1G -user xyz -iname adda.txt Example 32: Find all the files with SGID for the group sales and with size exactly 100MB with file name as pass.txt under /opt. find /opt -size 100M -group sales -perm g+s -name pass.txt Linux find command AND Operator By default find command will use AND option between two options. No need of mentioning any option. For example see below examples. Example 33: Find all the files which are more than 100MB and less than 1GB in size. find / -size +100M -size -1G or find / -size +100M -a -size -1G Like above we can combine many options and your find command use AND operator by default no need of mentioning -a option. Search for files and execute commands on Found files Caution: Be careful when using -exec option which you are going to learn below. This is very dangerous option which can change/remove anything if don’t use wisely. There are some instances when you want to execute commands on the found files with find...

Read More

SED(Stream EDitor ) Explained in detail for Linux/Unix

Learn SED with examples Before going to learn SED a brief intro is required. a)sed is a Stream EDitor. b)It reads line by line when a file is feed to it. c)sed will not edit the input file by default and it displays output on the screen. d)SED is mainly used for search for a term and replace with desired term in a file/stream SED can do following things. 1) Search and replace (s switch) –90 % of your SED related work is completed with this option 2) Printing (-n and p switch) 3) Editing (-I, w, d switch) 4) Multiple SED commands and continuation operation (-e and ; switch) 5) Line number ( , and = switch) 6) Search operation (/searcterm/) 7) Negation operation(!) 8) SED scripting operator (-f switch) 9) Miscellaneous SED examples Search and replace operator( s for search) Below is the syntax for search a term and replace it with another team. sed ‘s/searchterm/replaceterm/’ inputfile or cat inputfilename | sed ‘s/searchterm/replaceterm/’ or echo “This is test message” | sed ‘s/searchterm/replaceterm/’ Exameple1: Search for google in file:test.txt and replace with yahoo sed ‘s/google/yahoo/’ test.txt Example2: How about globally? By default sed will work on only first find term. Suppose I have following sentence. “sheena leads, sheila needs”. I want to replace sh with le. If I use below example it will replace only first occurrence. echo...

Read More

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.