Skip to main content

Command Line Part 1


Lecture 01 Commands Line introduction

Let's find all HTML files:
$ find . -name "*.html"
 




Extended Eg

Let's ensure that all our html files use HTML5
$ find . -name "*.html" -exec grep -i 'doctype' {} \;
 
 





Commands

ls

  • The command ls lists the files in a directory.
  • The command is documented in the manual
$ man ls
(Hint: type q to quit the manual).


Options

Most commands take options. For example:
  • -a, --all do not ignore entries starting with .
  • -1 list one file per line. Avoid '' with -q or -b
So we may
$ ls -a -1
$ ls -a1
$ ls --all -1

 

Piping

Piping using the | allows combining commands.
$ rpm -qa
lists all the installed packages on a RedHat/Fedora system.
$ rpm -qa | grep -i "Acrobat"
searches the list to see if the Acrobat PDF reader is installed.

 Note: the try with acrobat doesnt work because I do not have install any PDF since I'm just using an emulator (Virtual Machine) and I have not install anything on it.

Complex Eg

How do you list all the software licences of packages installed on your system?
$ rpm -qa --qf "%{license}\n" | sort | uniq
 

Filesystem

Try

$ cd ~
$ ls
$ ls -a
$ cd Documents
What does the -a option for ls do?

 -a includes the files, since ls only include carpets

Conclusion

  • There are many Linux commands.
  • Each command has options.
  • Some commands take other parameters.
  • Commands can be combined quickly to give impressive functionality.
  • The filesystem makes more sense than the Windows structure!

Comments

Popular posts from this blog

What is Eclipse IDE and how to install

What is Eclipse? Eclipse is an integrated development environment (IDE) used in computer programming, and is the most widely used Java IDE. It contains a base workspace and an extensible plug-in system for customizing the environment. Eclipse is written mostly in Java and its primary use is for developing Java applications, but it may also be used to develop applications in other programming languages via plug-ins, including  C, C++, Fortran, JavaScript,  and others. Development environments include the Eclipse Java development tools (JDT) for Java and Scala, Eclipse CDT for C/C++, and Eclipse PDT for PHP, among others. How to install Eclipse Step 1: First we are going to download Eclipse at their website, make sure you select the correct OS. Step 2: After you finish downloading it you will get a Zip file with the name of the Eclipse you just download, open it and extract it and after that you are going to run it and this is going to be ...

What is GitHub and how to use it

What is GitHub? GitHub is a web based Git or a version control repository and internet hosting service. It offers: Distributed version Control Source Code Management  Plans for free and private repositories on the same account Host Open source software projects Is a very useful tool for projects, can be accessed and manipulated using the standard git command line interface and all of the standard git commands works with it, github allows registered and not registered users to browse public repositories on the site it does also provides a social networking function such as: Feeds Followers Wikis Social network graph How to use it? Step 1: lets go to  GitHub Step 2: Create an account / Log in Step 3: Choose your plan, After you have create an account it will ask you if you want to be a free user or if you want to pay for it Step 4: Choose your l...

How to Install Fedora 25 on the OVM

How to Install fedora 25 on the OVM Since we already did download and install the OVM we will now move into installing the OS that we want in this tutorial I will be showing how to install Fedora-25 Step 1: Download the Fedora-25  OS, this is going to be an ISO which is a CD that need to be mounted to a Virtual Image I will show you how to do it step by step. Step 2: Open your OVM (Oracle Virtual Machine) and select the OS you want to emulate Make sure to name it in a way you can remember what OS is it, in this case I'm going to call mine Fedora25-Test for this tutorial Step 3: Select the resources you want to use for this OS and make sure to create a VIMD (Virtual Machine Disk) Make sure to have at least 30gb for the disk Step 4: After you finish the setup of your OS we are going now to install the Linux OS on it, go to the Settings option and select the next options Step 5: After click on ...