Author: Surendra Anne

wget download a file to a directory in Linux/Unix

Wget(Website get) is a Linux command line tool to download any file which is available through a network which has a hostname or IP address. With wget command we can download from an FTP or HTTP site as this supports many protocols like FTP, HTTP, https, ftps etc. By default wget command downloads files to the present working directory where you execute the command. This is a bit annoying as we have to move the downloaded file to a specific folder or we have to go the directory where you want that file downloaded and use wget command. In this post, we will see how to download to a specific location in the system. wget command syntax: wget <URL> To get downloaded file to a specific directory we should use -P or –directory-prefix=prefix. From wget man pages.        -P prefix        --directory-prefix=prefix            Set directory prefix to prefix.  The directory prefix is the directory where all other files and subdirectories will be saved to,            i.e. the top of the retrieval tree.  The default is . (the current directory). The syntax for downloading to a specific directory. wget -P <path> <URL> Example: wget -P /opt/mykernel/ Output: wget -P /opt/mykernel/ --2018-06-02 17:56:52-- Resolving,,, ... Connecting to||:443... connected. HTTP request sent, awaiting response......

Read More

GIT: How to compare two GIT branches?

Git is a versatile tool to do version control of project code. We can develop code with slight modifications using branches in GIT. Sometimes we require to compare two branches to see what difference in that two branches. In this post, we will see how to see a difference between two branches in a different way. Example1: Show all the files which are different between two branches. git diff --name-only branch_1..branch_2 Or git diff --name-only branch_1 branch_2 Example: git diff --name-only bug/fix_gcc_compiler...feature/test-12430 .kitchen.vagrant.yml .kitchen.yml Berksfile attributes/default.rb files/default/nonprod_pvm_ca_cert files/default/prod_pvm_ca_cert metadata.rb recipes/cleanup.rb recipes/configure.rb recipes/install.rb recipes/install_v4.rb recipes/install_v4_audit.rb spec/unit/recipes/cleanup_spec.rb spec/unit/recipes/configure_spec.rb spec/unit/recipes/install_spec.rb spec/wbc_nix_protectv_test/default_spec.rb This will list all the files which have difference instead of showing content. Example2: To see the difference of file content from different branches use below command git diff mybranch master — myfile.cs Example: git diff feature/test-23438 master -- metadata.rb diff --git a/metadata.rb b/metadata.rb index b373613..a794431 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ maintainer_email '' license          'all_rights' description      'Installs/Configures www_linuxnix_protectv' long_description 'Installs/Configures www_linuxnix_protectv' -version          '1.1.1' +version          '1.1.0' chef_version     '>= 12.5' if respond_to?(:chef_version) supports         'redhat' Example3: Get the difference between two branches. git diff branch_1..branch_2 Example: git diff feature/test-23438...

Read More

Online training on Linux Bash shell scripting

We are excited to announce our online training from this weekend. These trainings are in-person and online based through GoToMeeting software. The first training which is we are planning to give is “Bash shell scripting” for beginners. If you want to start coding for your system administration activities, then this course is for you. We will teach basics with some detailed explanation about each concept. Please find below curriculum on what we teach in this class. Please register for your self to join first two sessions for free of cost here: “Online shell scripting training” or fill below embedded form. Training Date and time: 10th Feb 2018, that is this Saturday and 8.30AM IST. Introductory Fee: $50. From next batch, the fee will be $100. Loading… About the trainer: Surendra Kumar Anne, Sr. Devops engineer. Content of course Basics of Unix/Linux (For nonsystem admins) History of Unix/Linux Flavors of Linux Linux Architecture Linux prompt and CLI Unix file systems(Directory structure) Shell scripting basics What is shell scripting? Why write a shell script? How to write shell scripts? Metadata in shell scripts Code in shell scripting Comments Executing shell script Debugging shell scripts Printing and Reading echo printf Read Redirection operators Input and output Redirection( <, > ) Input and output append redirection ( <<, >>) STDOUT/STDERR redirection(1, 2) /dev/null Variables and Arrays User-defined scalar variables or Strings System-defined scalar variables...

Read More

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

Email Subscribe


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.