Posts

Showing posts with the label introduction to linux

Printing Working Directory

Image
In order to discover where you are currently located within the filesystem, the  pwd  command can be used. The  pwd  command prints the working directory, your current location within the filesystem: pwd [ OPTIONS ] Know this !! Don't turn on your printer just yet! In the early days of computing the command line output would be sent to physical printers. This method was replaced by video displays which could display information more quickly. We still use the word  print  even though the output is just being displayed on your screen. sysadmin@localhost : ~ $ pwd /home/sysadmin The output of the above command indicates that the user is currently in their home folder, shown in the filesystem below. Dis you Notice! Notice our virtual machines employ a prompt that displays the current working directory, emphasized with the color blue. In the first prompt above, the blue  ~  is equivalent to  /home/sysadmin , representing the us...

Options

command [options…] [arguments…] Options can be used to alter the behavior of a command. On the previous page, the ls command was used to list the contents of a directory. In the following example, the  -l  option is provided to the  ls command, which results in a "long display" output, meaning the output gives more information about each of the files listed sysadmin@localhost : ~ $ ls -l total 32 drwxr-xr-x 2 sysadmin sysadmin 4096 Aug 4 20:58 Desktop drwxr-xr-x 4 sysadmin sysadmin 4096 Aug 4 20:58 Documents drwxr-xr-x 2 sysadmin sysadmin 4096 Aug 4 20:58 Downloads drwxr-xr-x 2 sysadmin sysadmin 4096 Aug 4 20:58 Music drwxr-xr-x 2 sysadmin sysadmin 4096 Aug 4 20:58 Pictures drwxr-xr-x 2 sysadmin sysadmin 4096 Aug 4 20:58 Public drwxr-xr-x 2 sysadmin sysadmin 4096 Aug 4 20:58 Templates drwxr-xr-x 2 sysadmin sysadmin 4096 Aug 4 20:58 Videos Often the character is chosen to be mnemonic for its purpose, like choosing the letter  l  for  ...

Arguments

command [options…] [arguments…] ​⁠​‌‌⁠⁠⁠⁠​ An argument can be used to specify something for the command to act upon. The  ls  command can be given the name of a directory as an argument, and it will list the contents of that directory. In the next example, the  Documents  directory will be used as an argument: sysadmin@localhost : ~ $ ls Documents School alpha-second.txt food.txt linux.txt os.csv Work alpha-third.txt hello.sh longfile.txt people.csv adjectives.txt alpha.txt hidden.txt newhome.txt profile.txt alpha-first.txt animals.txt letters.txt numbers.txt red.txt The resulting output is a list of files contained with the  Documents  directory. Because Linux is open source, there are some interesting secrets that have been added by developers. For example, the  aptitude  command is a package management tool available on some Linux distributions. This command will accept...

Basic Command Syntax

The CLI Terminal  The CLI terminal is a powerful tool that is often the primary method used to administer small low-power devices, extremely capable cloud computing servers, and everything in between. A basic understanding of the terminal is essential to diagnosing and fixing most Linux based systems. Since Linux has now become so ubiquitous, even those who plan on working primarily with systems not utilizing the Linux kernel can benefit from having a basic understanding of the terminal. What is a command? A command is a software program that when executed on the CLI (command line interface), performs an action on the computer. When you type in a command, a process is run by the operating system that can read input, manipulate data and produce output. A command runs a process on the operating system, which then causes the computer to perform a job. To execute a command, the first step is to type the name of the command. Type  ls  and hit  Enter . The result s...