Linux Command Line Basics: Introduction

Command Line, Linux

Technological Literacy

The What, The Why, & The How of: The Linux Command Line Interface- Introduction

Technological Terms to learn

what is the shell in Linux?

  • it’s a program that takes keyboard commands and passes them to the operating system to carry out

what is the terminal emulator?

  • gui or graphical user interface which allows you to interact with the shell

sources

Ubuntu Download
Ubuntu Boot from disc instructions

Linux Command Line Basics: Copy, Move, and Remove files and Directories

Command Line, Linux

I have a love of mystery and the command line is a mystery I look forward to understand. This article is a basic tutorial of how I learned to copy, move, and remove files and directories using the Linux command line.

The command line is the interface where we (people) can make the magic happen with computers. Basically we can do some powerful sh*t with fewer resources. For example we can search for files quickly, we can compress files easily, and we can secure communication with remote users. At least that is what I have been told and read online. The possibility of being able to make a computer do more cool sh*t is what inspired me to teach myself how the CLI (command line interface) works.

Basic Commands

First things first: you have to know where the reference manuals are for the commands. If you don’t, you could be functioning blind and just following others commands.

man

This command will show the reference manuals. Picture this command as the subconscous brain. It’ll show you what, and how these commands can be used.

  • man: short for manual
  • man + command will show you reference manual

“learn by doing”

  • open the terminal
  • enter man pwd on keyboard
  • what did you discover?

pwd

pwd command shows the directory you are currently in. Imagine this command as being your eyes for your present location.

  • print working directory
  • shows the current directory

“learn by doing”

  • open the terminal
  • enter “pwd” on keyboard
  • what did you discover?

clear

The clear command wipes the screen clear. This command is the broom you can use to give you a clean screen to work with.

  • clears the terminal

“learn by doing”.

  • enter “clear” on keyboard
  • what did you discover?

mkdir

The mkdir command is how you create new folders to work with. Directories are the places where the memories of you computer can be stored.

  • mkdir creates new directory

“learn by doing”.

  • open the terminal
  • enter “pwd” on keyboard
  • enter “mkdir newdir/” on keyboard
  • enter “ls” on keyboard
  • what did you discover?

ls

When ever you want to see the files listed in the current working director type the ls command. This command is the equivalent of you checking a list of ingredients for the wonderful food you make.

  • list files
  • shows the files in working directory

“learn by doing”.

  • open the terminal
  • enter “ls” on keyboard
  • what did you discover?

ls -a

If you want a deeper view of the ingredients of the files you are working with enter this flag at the end of the ls command. This allows for a more refine listing of the files viewed.

  • detail listing of all files in directory
  • notice the .bash files?
  • these are configuration files
  • not normally viewed with ls only

“learn by doing”.

  • open the terminal
  • enter “ls -a” on keyboard
  • what did you discover?

rmdir

We just created a new directory in the previous lbd. Now lets erase the directory from our memory.

  • rdmir removes empty directories only

“learn by doing”.

  • open the terminal
  • enter “rmdir newdir/” on keyboard
  • what did you discover?

cd

The cd command is how you change the directories you want to explore. Think about this command as if it was the remote control for your terminal. It allows you to surf the channels.

  • change directory

“learn by doing”.

  • open the terminal
  • enter “ls” on keyboard
  • enter “cd Documents” on keyboard
  • what did you discover?

“..”

Shortcuts are really helpful. I know my fingers get tired retyping certain keys and I love work arounds. Enter the “..”. This command allows you to hop up the tree quickly.

  • “..” moves up one level on the directory tree

“learn by doing”.

  • open the terminal
  • enter “ls” on keyboard
  • enter “cd Documents” on keyboard
  • enter “cd ..” on keyboard
  • what did you discover?

tab key

Since we are discussing shortcuts we can’t forget autocomplete. The tab button has the honor of thinking what the rest of the words will be after the first few characters have been entered.

  • tab is the autocomplete button

“learn by doing”.

  • open the terminal
  • enter “ls” on keyboard
  • enter “cd Doc + tab” on keyboard
  • what did you discover?

create files with vi editor

The vi editor allows you to edit and create files in the terminal. The powerful vi is a cool little program. My fingers tend to get mixed up dealing with how the commands are entered when using this editor. This will tend to correct itself after the muscle memory kicks in as you continue using it.

  • vi newfile

“learn by doing”.

  • open the terminal
  • enter “vi newfile” on keyboard
  • enter “i” on keyboard: input mode
  • enter “this is a new file” on keyboard
  • enter “:wq” on keyboard to save and escape vi editor
  • enter “ls” on keyboard
  • what did you discover?

mv

We’ve covered a bit of ground navigating through the command line interface. Now let’s create some files and directories using the vi editor.

  • mv: moves files/directories
  • mv: renames files/directories

“learn by doing”.

  • open the terminal
  • enter “mv newfile newfile1” on keyboard
  • what did you discover?

tail

The language for the command line is uber intuitive sometimes. Notice the commands are either abbreviations or one word concept statements for what the command might do. Now imagine what the tail command outputs?

  • shows the last part of files

“learn by doing”.

  • open the terminal
  • enter “tail newfile” on keyboard
  • what did you discover?

head

The file we created is like a body. It has abstract versions of tails and heads. Since we know what the tail command does, just imagine what the head command will show us!

  • shows the first part of files

“learn by doing”.

  • open the terminal
  • enter “head newfile” on keyboard
  • what did you discover?

cat

This is such a chill word. The word catenate literally means chain in Latin. This command joins all the files together when summoned by the command line.

  • links together (concatenate) files

“learn by doing”.

  • open the terminal
  • enter “cat newfile” on keyboard
  • what did you discover?

cp

Lets learn how to clone files and directories with the copy command.

  • copies file and directories

“learn by doing”.

  • open the terminal
  • enter &quotcp newfile newfile1;” on keyboard
  • enter “ls” on keyboard
  • what did you discover?
  • open the terminal
  • enter &quotcp newdir/ newdir1/;” on keyboard
  • enter “ls” on keyboard
  • what did you discover?

rm

Well it is time to learn how to clean up the directories and files a bit. You don’t want to create a sh*t load of directories and files without knowing the tools of how to remove them.

  • removes files and directories

“learn by doing”.

  • open the terminal
  • enter “ls” on keyboard
  • enter “rm newfile1” on keyboard
  • enter “ls” on keyboard
  • what did you discover?
  • open the terminal
  • enter “ls” on keyboard
  • enter “rm -r newdir/” on keyboard
  • enter “ls” on keyboard
  • what did you discover?

Conclusion

The command line is a fun place to play in when you want to control what and how your computer functions. The skills you develop take time and patience. Crush it!

Linux Filesystem Hierarchy Standard

Command Line, Linux

512px-Tux.svg

File System:
a system for storing data in separate groups.
What is a directory?

A directory is simply a group of files.

Directories are used to organize your data files and programs more efficiently.

    2 types of directories:

  1. Root directory
  2. Sub directory
    directory under root which can be created, can be renamed by user.

——–

Linux Filesystem Hierarchy

——–

  1. / (root)

    every single file and directory starts from the root directory
  2. /bin (user binaries)
    contains *binary executable’s
    binary file
    a computer file that is not text file. usually encoded in binary file formats (represented in 0’s and 1’s).
  3. /sbin (system binaries)
    commands in this directory are typically executable’s used for system maintenance and/or administrative tasks.
  4. /etc (configuration files)
    visualize this directory as the nerve center of your computer system.
    contains configuration files required by all programs.
    contains startup and shutdown shell scripts used to start or stop individual programs.
  5. /dev (device files)
    the location of special or device files.
    ****highlights one important aspect of the Linux file system – everything is a file or a directory.****
  6. /proc (process info)
    This directory is regarded as a control and information center for the kernel.
    contains information about system process.
    its a virtual file system which provides an interface to communicate with the kernel and presents information about processes and other system information.
  7. /var (variable files)
    contains variable data
    i.e. files and directories the system must be able to write to during operation, whereas **/usr** should only contain static data.
    contents of the files that are expected to grow can be found here.

  8. /tmp (temporary files)
    temporary files created by system and users.
    files under this directory are deleted when the system is rebooted.
    Do not remove files from this directory unless you know exactly what you are doing.
    Many of these files are important for currently running programs and deleting them may result in a system crash.
  9. /usr (user programs)
    contains all the user binaries, their documentation, libraries, header files, source-code, etc…
  10. /home (home directory)
    home directories for all users to store their personal files.
    /home can get quite large and can be used for storing downloads, compiling, installing and running programs, your mail, your collection of image or sound files etc.

  11. /boot (boot loader files)
    contains everything required for the boot process except for configuration files not needed at boot time.
    stores data that is used before the kernel begins executing user-mode programs.
  12. /lib (system libraries)
    contains kernel modules and those shared library images *(the C programming code library) needed to boot the system and run the commands in the root file system.
  13. /opt (optional add-on applications)
    contains add on apps from individual vendors.
    all third party applications should be installed in this directory.
  14. /mnt (mount directory)
    temporary mounts directory for removable devices.
    Before one can use a file system, it has to be mounted.
  15. /media (removable devices)
    temporary mounts directory for removable media devices.
  16. /srv (services device)
    contains site-specific data which is served by this system.

What is a Unix Like Operating System?

Command Line, Linux
Operating System

Operating System

I asked myself a question one day: What is a Unix-Like Operating system? I felt completely overwhelmed when I tried to answer this question. I ended up searching the depths of the Collective Brain of the Internet to discover a satisfying answer.

What I discovered was interesting. An Operating System is a new form of life created to assist our lives with the mundane. The computer software running behind the scenes is needed to manage the physiology of the computer.

The source code of the Operating System is the DNA of the computer. And the set of command instructions that performs a specific process is how the Operating System functions are carried out.

In this tutorial I will use the trivium method of classical education to answer: What is a Unix Like Operating System?

——–

The Trivium method has 3 elements:

  1. General Grammar: Systematic Knowledge
    • answers the questions of the who, what, where, and when of this subject.
    • discovering and ordering facts of reality comprise basic, systematic knowledge.
  2. Formal Logic: Systematic Understanding
    • answers the why of this subject.
    • developing the faculty of reason in establishing valid (non-contradictory) relationships among facts, Systematic Understanding.
  3. Classical Rhetoric: Systematically usable Knowledge and Understanding
    • provides the how of a subject.
    • applying knowledge and understanding expressively comprises wisdom, or, in other words, it is a systematically usable knowledge and understanding.

——–

Grammar

This Section will clearly define the Terms of the key elements for the definition of Operating System.

Each term that is defined will have a “*” next to terms within the definition. These definiens will clearly be defined for further clarity until a root of understanding is established.

Operating System
*software that manages *computer-hardware resources and provides common *services for *computer-programs.

——–

Software (aka computer programs)
clearly defined instructions that upon execution instructs hardware to perform the tasks it is designed for.

——–

Computer-hardware
the physical parts of the computer (everything that can be touched).
components:
  • monitor
  • mouse (track pad)
  • keyboard
  • computer data storage (RAM)
  • Hard drive
  • System Units:
    1. graphics cards
    2. sound cards
    3. memory
    4. mobo aka Motherboard
    5. chips (CPU)

——–

*Services
Daemon (not to be confused with the daemon that is an evil supernatural being or a person who is part mortal and part god)
(in computing) program that runs as a *background-process, rather than being under the direct control of an interactive user.

*background-process
a *computer *process that “runs behind the scenes” without user intervention.
*process (definition proper; process- a particular course of action intended to achieve a result)
the actual execution of the instructions of a *computer program (a passive collection of instructions).

——–

*Computer Program
a sequence of *instructions, written to perform a specified task with a computer.
a computer requires programs to function. typically *executing the programs instructions in a CPU.
a program has an *executable form that the computer can directly execute.
the same program in its human readable *source code form; from which executable programs are derived (compiled), enables a programmer to study and develop *algorithms. (you learn how the program works).

——–

Computer Program Knowledge Tree
*Instruction Set
defines the codes that a CPU reads and acts upon.
its the machine language (or assembly language).
*Execution (proper definition; execute- carry out or perform a process)
process by which a computer performs the instructions of a computer program.
programs may execute in a *batch-process without human interaction.
programs may execute by a user typing *commands in an *interactive *session of an *interpreter.
*batch-process (proper definition; batch- a collection of things. process- a course of action intended to achieve a result)
execution of a series of programs (jobs) on a computer without manual intervention.
all input parameters are predefined through scripts, command line arguments, control files, or job control language.
*command (proper definition; an instruction to do something)
a directive to a computing program acting as an interpreter in order to perform a specific task.
a command is a directive to some kind of command line interface, such as a shell.
*interactive session (proper definition; interactive- capable of acting on or influencing each other. session- a meeting for execution of a group’s functions)
a semi-permanent interactive information interchange (dialogue) a conversation or a meeting between 2 or more communicating devices, or between computer and user.
*interpreter
a program that translates and executes source language statements one line at a time.

——–

*Source Code (definition proper; source- the place where something begins, where it springs into being. code- the symbolic arrangement of data or instruction in a computer program or the set of such instructions)
any collection of computer instructions (possibly with comments) written using some *human-readable computer language, usually as text.
source code is transformed by a *compiler into low-level machine code understood by the computer.
source code can mean any fully executable description of a software system.
source code which constitutes a program is held in one or more text files stored on a computers hard disk.
files are arranged in a *directory-tree, aka source tree.

*compiler (definition proper; a program that decodes instruction written in a higher order language and produces assembly language program)
a computer program or set of programs that transforms source code written in a programming language (source code) into another language (the target language, often having a binary form known as object code).
programs that translate source code from a high level language to a lower level language (assembly language).
*directory tree (definition proper; directory- a listing of files stored in memory)
*FHS (file-system hierarchy standard)
defines the directory structure and directory contents in Unix and Unix-like operating systems.

What is Linux

Command Line, Linux
My name is Tux

My name is Tux

Linux is a collection of software (Operating System) running behind the scenes on a computer.

Why you begin with the history of the word and cognitive synonyms?

The birth place of words are in peoples minds. They become the blocks we use to build what we see, hear, taste, touch and smell (our senses). When you read you are condensing your senses into a chain of links from a set of symbols. These visible symbols are the anchors you chunk into your vocabulary to name your thoughts and beliefs.

The purpose of reading a list of the history of a word is to build your relationship as the word grew-up in time. The family origins of a word connects the anchor to the chain of how the words story sprouted in someones mind.

The cognitive synonyms (synset for short) are the present sprouted offspring of the word. They provide you with fresh mental anchors to the chain of the words story.

Read the groups of words to see their birth.

Connect with the anchors to the story of the words to see how they’ve grown.

The Linux Operating System is:

  1. free to download and use.
  2. free to copy and share with anyone.
  3. free to study and learn how the Operating system works.
  4. free to transform into something tailor made for you.

———-

Proper definition:
Linux is a *Unix-like *Operating System and mostly *POSIX-compliant computer operating system assembled under the model of *free and *open source software development and distribution. (source)

Each term that is defined will have a “*” next to terms within the definition. These definiens will clearly be defined for further clarity until a root of understanding is established.

———-
In this tutorial I will use the Trivium Method of classical education to better understand “What is Linux.”

The Trivium method has 3 elements:

  1. General Grammar: Systematic Knowledge
    • answers the questions of the who, what, where, and when of this subject.
    • discovering and ordering facts of reality comprise basic, systematic knowledge.
  2. Formal Logic: Systematic Understanding
    • answers the why of this subject.
    • developing the faculty of reason in establishing valid (non-contradictory) relationships among facts, Systematic Understanding.
  3. Classical Rhetoric: Systematically usable Knowledge and Understanding
    • provides the how of a subject.
    • applying knowledge and understanding expressively comprises wisdom, or, in other words, it is a systematically usable knowledge and understanding.

———-

Grammar:

The terms must clearly be defined in order to gain the systematic knowledge to better understand “What is Linux.”

GNU (GNU’s not Unix)
Project- goal
to give users freedom and control in their use of their computers and computing devices.
develop and provide software based on the following freedom
rights:

  • Use: users are free to run the software
  • Share: users are free to share the software (copy and distribute freely)
  • Study: users are free to study the software
  • Modify: users are free to modify the software (copy and redistribute freely)
Unix-Like
an operating system that behaves in the manner similar to UNIX, while not necessarily conforming to or being certified to any version of the Single Unix specification.
Operating System
a collection of software running behind the scenes of a computer.
POSIX

an acronym for “PORTABLE OPERATING SYSTEM INTERFACE”a family of standards specified by the *IEEE (institute of electrical engineers- i triple e) for maintaining compatibility between operating systems.defines the API (application program interface), command line shells, and utility interfaces for software compatibility with variants of Unix and other Operating Systems.

Free and Open Source Software (FOSS)
computer software that can be classified both *free and *open source.
Free Software
software that is distributed with its source code and released under a (*GNU) software license that guarantee users the freedom to run the software for any purpose as well as to study, adapt/modify, and distribute the software and the adapted/changed versions.
Open-Source Software (OSS)
software with its source code made available and licensed with a license in which the copyright holder provided the rights to study, change, and distribute the software to anyone and for any purpose.
developed in a public, collaborative manner.
Open Source Development
open source software is the best example.
user generated content:
content produced through *open-collaboration.
open-collaboration:
created by goal oriented yet loosely coordinated participants who interact to create a product or service of economic value, which they make available to contributors and non contributors alike.
open content:
describes a creative work that others can copy or modify.
creative work that is freely available for modification, use, and redistribution under a license similar to those of OSS and FOSS community.
users have the right to make more kinds of uses than those normally permitted under the law at no cost to the user.
5 right’s of a Open Content Users:
  1. retain
  2. reuse
  3. revise
  4. remix
  5. redistribute

How to install Xubuntu on a Windows 7 Machine

Command Line, Linux

Having the ability to use multiple operating systems on your machine will give you the tools necessary to have a symbiotic relationship with your machine.

In this tutorial I will use the trivium method of classical education for the Xubuntu installation process.

The Trivium method has 3 elements:

  1. General Grammar: Systematic Knowledge
    • answers the questions of the who, what, where, and when of this subject.
    • discovering and ordering facts of reality comprise basic, systematic knowledge.
  2. Formal Logic: Systematic Understanding
    • answers the why of this subject.
    • developing the faculty of reason in establishing valid (non-contradictory) relationships among facts, Systematic Understanding.
  3. Classical Rhetoric: Systematically usable Knowledge and Understanding
    • provides the how of a subject.
    • applying knowledge and understanding expressively comprises wisdom, or, in other words, it is a systematically usable knowledge and understanding.

Grammar:

Operating System
a collection of software running behind the scenes of a computer.
Xubuntu
a derivative of the Ubuntu Operating System; developed to be “fast and lightweight.”
Boot
cause to load (an OS) and start the initial processes.
Dual Booting
installing multiple Operating systems on a computer.
UEFI (unified extensible firmware interface)
a technical standard that defines software interface between an operating system and platform firmware.
Partition
the part of a hard drive that is dedicated to a particular OS or application and accesses as a single digit.
GParted
free partition editor.
GTK+ (gimp toolkit)
cross platform widget toolkit for creating graphical user interface.
Installation Image (ISO disc)
copy of the data on an optical disc, stored inside a binary file.

********

Formal Logic:

Before starting the process of installing Xubuntu on your Windows machine, we first need to gather the necessary technology.

Items needed:

********

Installation Process:
Burning ISO on DVD
  1. download ISO from Linux source
  2. Burning From Windows
    • right click on ISO image
    • select disk burner (drive)
    • press “burn”
  3. verify disc after burning

****

Partitioning Windows hard drive

Path //////

  1. go to start menu
  2. search for disk management
  3. select “create and format hard drive”
  4. this open “disk management”
  5. right click the largest hard drive
  6. choose “shrink volume”
    • windows will think about this question. be patient as the icon spins and you end up in a psychedelic state…
  7. enter the size of volume to create in MB (megabytes) or accept the maximum default size and click next.
  8. Size chart
    1024 bytes = 1 kilobyte
    1024 kilobytes = 1 megabyte
    1024 megabytes = 1 gigabyte
    1024 gigabytes = 1 terabyte
    1024 terabytes = 1 petabyte
  9. shrink to XXXX MB (unallocated)
  10. close

***End of Windows Hard Drive Partition***

Boot Computer from Live Cd image and follow the prompts in the set up

***do a search online to check your computer models protocol to boot from cd***

  1. restart computer with disk image in drive.
  2. IBM press F12 to enter UEFI.
  3. boot from cd.
  4. Install ***distro varies *** Xubuntu.
  5. connect computer to router with ethernet.
  6. when you see the keyboard and symbol on the bottom of the screen tap any key to proceed.
  7. continue through installation windows.
  8. window will ask: “how do you want to partition the disk?”
  9. install to the partition created in Windows.
  10. automatic partition resizing (recommended).
  11. (GUI): install them side by side between startup.
  12. select size of partition.
  13. click on continue.
  14. install now.
  15. follow prompts.
  16. restart computer,

Dual boot process is complete…