Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to use terminal of Linux?

Here you can discuss every aspect of Debian. Note: not for support requests!
Post Reply
Message
Author
Noob_Command_Line
Posts: 5
Joined: 2018-07-07 01:58

How to use terminal of Linux?

#1 Post by Noob_Command_Line »

I want to learn command line of Linux.

How to use terminal of Linux?

Bulkley
Posts: 6382
Joined: 2006-02-11 18:35
Has thanked: 2 times
Been thanked: 39 times

Re: How to use terminal of Linux?

#2 Post by Bulkley »


User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: How to use terminal of Linux?

#3 Post by GarryRicketson »

Type "help" at the prompt:
I don't have the Debian help handy, as I am using OpenBsd at the moment, but
it is a use full command, if the OS has a good "help" page, usually any linux system will have a help page, and manuals.
===However recently we had a beginner, and saddly, what Microsoft store is calling "Debian" and offers,
does not even come with manual pages or the 'man' command.
(more on that :http://forums.debian.net/viewtopic.php?f=30&t=137960 )===
But that is not really Linux, nor the topic,... any way:
==============
Example:

Code: Select all

$ help
HELP(1)                     General Commands Manual                    HELP(1)

NAME
     help - help for new users and administrators

DESCRIPTION
     This document is meant to familiarize new users and system administrators
     with OpenBSD and, if necessary, UNIX in general.
/tmp/man.GP1Z2VmM6X (6%)...skipping...
HELP(1)                     General Commands Manual                    HELP(1)

NAME
     help - help for new users and administrators

DESCRIPTION
     This document is meant to familiarize new users and system administrators
     with OpenBSD and, if necessary, UNIX in general.

     Firstly, a wealth of information is contained within the system manual
     pages.  In UNIX, the man(1) command is used to view them.  Type man man
     for instructions on how to use it properly.  Pay especially close
     attention to the -k option.

     Other OpenBSD references include the FAQ (Frequently Asked Questions)
     located at
           https://www.openbsd.org/faq/,
     which is mostly intended for administrators and assumes the reader
     possesses a working knowledge of UNIX.  There are also mailing lists in
     place where questions are fielded by OpenBSD developers and other users;
     see
           https://www.openbsd.org/mail.html.

     System administrators should have already read the afterboot(8) man page
     which explains a variety of tasks that are typically performed after the
     first system boot.  When configuring any aspect of the system, first
     consider any possible security implications your changes may have.

   The Unix shell
     After logging in, some system messages are typically displayed, and then
     the user is able to enter commands to be processed by the shell program.
     The shell is a command-line interpreter that reads user input (normally
     from a terminal) and executes commands.  There are many different shells
     available; OpenBSD ships with csh(1), ksh(1), and sh(1).  Each user's
     shell is indicated by the last field of their corresponding entry in the
     system password file (/etc/passwd).

   Basic Unix commands
     man       Interface to the system manual pages.  For any of the commands
               listed below, type man command for detailed information on what
               it does and how to use it.

     pwd       Print working directory.  Files are organized in a hierarchy
               (see hier(7)) called a tree.  This command will indicate in
               which directory you are currently located.

     cd        Change working directory.  Use this command to navigate
               throughout the file hierarchy.  For example, type cd / to
               change the working directory to the root.

     ls        List directory contents.  Type ls -l for a detailed listing.

     cat       Although it has many more uses, cat filename will print the
               contents of a plain-text file to the screen.

     vi        Edit text files.  For example, vi filename.  See also mg(1).

     mkdir     Make a directory.  For example, mkdir dirname.

     rmdir     Remove a directory.

     rm        Remove files.  Files are generally only removable by their
               owners.  See the chmod(1) command for information on file
               permissions.

     chmod     Change file modes, including permissions.  It is not
               immediately obvious how to use this command; please read its
               manual page carefully, as proper file permissions, especially
               on system files, are vital in maintaining security and
               integrity.

     cp        Copy files.

     mv        Move and rename files.

     ps        List active processes.  Most UNIX-based operating systems,
               including OpenBSD, are multitasking, meaning many programs
               share system resources at the same time.  A common usage is ps
               -auxw, which will display information about all active
               processes.

     kill      Kill processes.  Used mostly for terminating run-
               away/unresponsive programs, but also used to signal programs
               for requesting certain operations (e.g., re-read their
               configuration).

     date      Print the current system date and time.

     mail      Access mailbox.

     exit      Log out of the system.

     When a command is entered, it is first checked to see if it is built-in
     to the shell.  If not, the shell looks for the command in any directories
     contained within the PATH environment variable (see environ(7)).  If the
     command is not found, an error message is printed.  Otherwise, the shell
     runs the command, passing it any arguments specified on the command line.

     Shell built-in commands do not have their own manual page, so it's
     necessary to read the manual page for the user's shell.  Tools such as
     which(1) and "whence", a ksh(1) built-in command, can be used to see what
     commands are being executed.

SEE ALSO
     csh(1), ksh(1), man(1), whatis(1), whereis(1), which(1), afterboot(8)

HISTORY
     This manual page was written by Aaron Campbell <aaron@openbsd.org> and
     first appeared in OpenBSD 2.6.

OpenBSD 6.2                      July 13, 2017            
It has been so long, but if my memory serves my right , (often it doesn'),
seems like on Debian, the 'help' command gives a page with a list of commands, then you use the 'man' command:
For example the 'ls' command, listed in the help menu;
ls List directory contents. Type ls -l for a detailed listing.
If you need more details on using the 'ls' command:

Code: Select all

man ls
LS(1) General Commands Manual LS(1)

NAME
ls - list directory contents

SYNOPSIS
ls [-1AaCcdFfgHhikLlmnopqRrSsTtux] [file ...]

DESCRIPTION
For each operand that names a file of a type other than directory, ls
displays its name as well as any requested, associated information. For
each named directory, ls displays the names of files contained within
that directory, as well as any requested, associated information.

If no operands are given, the contents of the current directory are
displayed. If more than one operand is given, non-directory operands are
displayed first; directory and non-directory operands are sorted
separately and in lexicographical order. By default, ls lists one entry
per line to standard output; the exceptions are to terminals or when the
-C, -m, or -x options are specified.

The options are as follows:

-1 (The numeric digit "one".) Force output to be one entry per line.
This is the default when output is not to a terminal.----- snip ---
I am not going to post the entire manual, it is several pages,.....
Then you can also write scripts and "mini programs", make the executable, and add additional commands, or look for packages with utilities that will include additional commands,... Unix,Linux , and other unix like systems are very user friendly in this was, you can use the terminal to do anything,
How to learn to use it (the commandline) ? PRACTICE , the more you use it, the friendlier it gets, read the manual pages, I like and enjoy reading them, and the more one reads them, the more sense they start making, at first they may almost seem like gibberish, but with time, and more reading, it gets easier.
Kind of like learning a new language, you speak to the computer, with commands, it will talk to you and explain with it's manuals, also the error messages, often tell you why the command did not work,....
I often forget things and made a script to help me remember who I am talking to when I am using the terminal, so I just ask it,... :

Code: Select all

$ whoareyou
I am your pc
OpenBSD garry.garry.org 6.2 GENERIC.MP#1 amd64
Anything else ?
 
If I type 'help', it shows me a list of the basic commands, that I often can not remember,... pretty convenient isn't it ?

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: How to use terminal of Linux?

#4 Post by Dai_trying »

One site I used when learning bash was tldp.org it has some useful examples and explanations.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: How to use terminal of Linux?

#5 Post by Head_on_a_Stick »

GarryRicketson wrote:Type "help" at the prompt
That doesn't work in Debian:

Code: Select all

empty@hegel:~ $ help
ksh: help: not found
127|empty@hegel:~ $
The Linux equivalent would be

Code: Select all

man 1 intro
My favorite website for shell scripting is this one:

https://mywiki.wooledge.org/BashGuide

And my favorite shell is http://www.mirbsd.org/mksh.htm (available in Debian and maintained by the author).
deadbang

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: How to use terminal of Linux?

#6 Post by debiman »

all these are good answers.
i must say, i learned most by taking an existing script and
a) see how it ticks, and how the creator coded it
b) make modifications to it to suit my needs

in other words, learning by doing.

arzgi
Posts: 1183
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: How to use terminal of Linux?

#7 Post by arzgi »

Head_on_a_Stick wrote:
GarryRicketson wrote:Type "help" at the prompt
That doesn't work in Debian:

Code: Select all

empty@hegel:~ $ help
ksh: help: not found
127|empty@hegel:~ $
I don't know what is different, but for me it works:

Code: Select all

arto@samsung:~$ uname -a
Linux samsung 4.9.0-4-686 #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23) i686 GNU/Linux
arto@samsung:~$ help
GNU bash, versio 4.4.12(1)-release (i686-pc-linux-gnu)
Nämä komennot on määritelty sisäisesti.  Kirjoita ”help” nähdäksesi tämän listan.
Kirjoita ”help name” saadaksesi lisätietoja funktiosta ”name”.
Komennolla ”info bash” saat lisää yleisiä tietoja komentotulkista.
Käytä komentoa ”man -k” tai ”info” saadaksesi lisätietoja komennoista, jotka eivät ole tällä listalla.

Asteriski (*) nimen vieressä tarkoittaa, että komennon käyttö on estetty.

 työtunniste [&]                         history [-c] [-d erotus] [n] tai his>
 (( lauseke ))                           if KOMENNOT; then KOMENNOT; [ elif K>
 . tiedosto [argumentit]                 jobs [-lnprs] [työtunniste ...] tai >
 :                                       kill [-s signaalitunniste | -n signa>
 [ arg... ]                              let arg [arg ...]
 [[ lauseke ]]                           local [valitsin] nimi[=arvo] ...
 alias [-p] [nimi[=arvo] ... ]           lopetus [n]
 bg [työtunniste ...]                    mapfile [-d delim] [-n count] [-O or>
 bind [-lpsvPSVX] [-m keymap] [-f file>  popd [-n] [+N | -N]
 break [n]                               printf [-v muuttuja] muoto [argument>
 builtin [sisäänrakennettu komento [ar>  pushd [-n] [+N | -N | hakemisto]
 caller [expr]                           pwd [-LP]
....
So it lists bash builtins, and yes, it is localized in finnish, if you want to learn :mrgreen:

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: How to use terminal of Linux?

#8 Post by Head_on_a_Stick »

arzgi wrote:I don't know what is different
I'm not using bash:

Code: Select all

empty@hegel:~ $ echo $SHELL
/bin/mksh
empty@hegel:~ $
Thanks for clarifying!
deadbang

Noob_Command_Line
Posts: 5
Joined: 2018-07-07 01:58

Re: How to use terminal of Linux?

#9 Post by Noob_Command_Line »

I have questions about use of Linux commands of terminal , for example, how to install programs and how to use text editors, but that is the subject of another topic :wink:

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: How to use terminal of Linux?

#10 Post by GarryRicketson »

Yes it would be another topic, but before you ask you should read these first:
Please Read.. What we expect you have already Done.
==== and:
Forum guidelines. Please read before first post!
====
With that said, for example, the question you asked here, "How to use terminal of Linux?"
How to use terminal of Linux?
This could have been answered by doing a search, and reading some of the many results.
=== Please don't be a"help vampire"
Try using a search engine, and some logic, for example this question,
" how to install programs", to start with, that won't work well, be specific
"how to install programs on Debian" (if you are using Debian)
Usually on Linux distros, we call them "packages" and you need to include the distro, just asking "How do I install programs on Linux" all though that will get quite a few results, each Linux distro has different methods of installing packages (programs )
Example: How do I install programs on Linux
To get better more specific results, use the distro name:
" How do I install programs on Debian ?"
Try it , and you will see there is plenty of documentation for Debian.
how to use text editors
The same, you can do some searches on that yourself, if there is some valid reason you can not do any kind of searches, you should tell us, right at the start, but just because you don't feel like it, is not a valid reason, it is possible since you are new, you might not know how, but now you do know.
There are many different text editors, for Linux, and each one has it's own manual, which you should read before asking on a forum, "How do I use a text editor ? ",...Example: If you use "nano", and have it installed ,At the command line prompt simply type :

Code: Select all

man nano
Replace "nano" with the name of the editor, IE: "man leafpad", "man vi",etc.
Or paste into your favourite search engine:

Code: Select all

How do I use the nano editor ? 
So that ends this lesson.
====
There is no real reason any one should have to write long or even short tutorials, just for you, when there are all ready 100s available online, if you just learn how to use a search engine.
Last edited by GarryRicketson on 2018-07-08 13:25, edited 1 time in total.

MALsPa
Posts: 678
Joined: 2007-12-07 19:20
Location: albuquerque
Been thanked: 2 times

Re: How to use terminal of Linux?

#11 Post by MALsPa »

I studied stuff from books and online resources such as others have mentioned here, and I took a lot of notes. Learning to use man pages was essential for me. Also, keep practicing, and give it time. And it's very helpful to learn to use bash history so you won't have to keep re-typing commands all the time.

kevinthefixer
Posts: 190
Joined: 2018-05-05 22:30

Re: How to use terminal of Linux?

#12 Post by kevinthefixer »

Let me add that, at this point in the development of Linux in general and Debian in particular, extensive CLI skills are not necessary for any but developers. My CLI knowledge is little better than rudimentary, and I've been using Linux for nearly 20 years now, more and more. Terminal is not going away, even DOS still exists in Windows, but it's less and less a daily routine. My poor skills are adequate to fine-tune the Stretch installation on my old Dell laptop. So what I'm saying is that you don't need to be a computer science major to use Linux as a daily driver anymore.

Noob_Command_Line
Posts: 5
Joined: 2018-07-07 01:58

Re: How to use terminal of Linux?

#13 Post by Noob_Command_Line »

GarryRicketson wrote:Yes it would be another topic, but before you ask you should read these first:
Please Read.. What we expect you have already Done.
==== and:
Forum guidelines. Please read before first post!
====
With that said, for example, the question you asked here, "How to use terminal of Linux?"
How to use terminal of Linux?
This could have been answered by doing a search, and reading some of the many results.
=== Please don't be a"help vampire"
Try using a search engine, and some logic, for example this question,
" how to install programs", to start with, that won't work well, be specific
"how to install programs on Debian" (if you are using Debian)
Usually on Linux distros, we call them "packages" and you need to include the distro, just asking "How do I install programs on Linux" all though that will get quite a few results, each Linux distro has different methods of installing packages (programs )
Example: How do I install programs on Linux
To get better more specific results, use the distro name:
" How do I install programs on Debian ?"
Try it , and you will see there is plenty of documentation for Debian.
how to use text editors
The same, you can do some searches on that yourself, if there is some valid reason you can not do any kind of searches, you should tell us, right at the start, but just because you don't feel like it, is not a valid reason, it is possible since you are new, you might not know how, but now you do know.
There are many different text editors, for Linux, and each one has it's own manual, which you should read before asking on a forum, "How do I use a text editor ? ",...Example: If you use "nano", and have it installed ,At the command line prompt simply type :

Code: Select all

man nano
Replace "nano" with the name of the editor, IE: "man leafpad", "man vi",etc.
Or paste into your favourite search engine:

Code: Select all

How do I use the nano editor ? 
So that ends this lesson.
====
There is no real reason any one should have to write long or even short tutorials, just for you, when there are all ready 100s available online, if you just learn how to use a search engine.
@GarryRicketson,

I typed in a search engine "How do I use the nano editor"?:

http://lmgtfy.com/?q="How+do+I+use+the+nano+editor"

The first page show results of years 2017 and 2018.

Maybe others pages show results of years 2015, 2010, 2008...

What are the current results?

For example, the results of year 2017 are current results?

The results of years 2008, 2010, 2012, 2015 and 2016 are current results?

kevinthefixer
Posts: 190
Joined: 2018-05-05 22:30

Re: How to use terminal of Linux?

#14 Post by kevinthefixer »

For Nano, it won't matter much. Actually "man nano" would probably be the best place to start. If it isn't installed,
https://wiki.debian.org/manpages.debian.org

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: How to use terminal of Linux?

#15 Post by GarryRicketson »

Agree, the wiki would be the best place to start, especially if nano is not all ready installed.
What are the current results?
The current results would be the ones for 2018, I think that is what
year it is.
It is best to use the more recent results in some cases, but also often
the top results are the worse, and mostly advertisements, or SEO promotions,
The so called SEO engineers have done a good job of spamming the search engines, and messing them up, to the extent that it is questionable as to how useful they really are. The mess they have made, is a big reason many people do not want to use them, but that is another topic,..
Do not use " marks in your search string.
And Google, is ok, but you probably will get a lot of advertisements, and not much for useful results.
Example: Copy/paste the key words

Code: Select all

How to use the nano editor
No "" quotation marks
How to use the nano editor
Nano is a very simple editor, and has been used for a real long time, it has not
changed much over the years, so most any results would still apply.
It also has it's own "help" menu, "ctrl + G" or ^G the ^ symbol means the
"CTRL" key,...

DO NOT use nano as root, until you get familiar with it, also it is all ways a good idea to use the 'cp' command, and copy the file you plan to edit.
For example, I want to edit: wget.txt, in my home dir /home/garry

Code: Select all

$ pwd                      
/home/garry
$ cp wget.txt wget-org.txt 
 
Note, I use 'pwd' to see what directory I am in.
After copying the original file, to a -org name, (it can be any name, but I find the -org easy to remember, "org" for original), any way, after copying the file,
you are ready to edit the original one.

Code: Select all

nano wget.txt
or what ever the file name is.
Down at the bottom of the screen there is a menu of sorts, to help you.
========

kevinthefixer » So what I'm saying is that you don't need to be a computer science major to use Linux as a daily driver anymore.
Well, that is true, but you also do not need to be a computer science major to
use the linux terminal. It mostly is a matter of what you are comfortable with.
I am a far cry from being a "computer science major", in fact I stopped going to school at about 11 years old, 5th grade,... never have taken any computer science courses.
How ever , when I did start using computers, at that time we did not have anything more then a command line terminal, ..the modern GUIs,etc. did not exist yet, and to this day I am more comfortable using a terminal,..
I like the XFCE4-terminal the most, but again that is a matter of preference.
I am not a developer either, all though I do write my own scripts, and have written a few personal "programs", one does not need to be a computer science major to do those things.
I will admit, the first time I logged into a Unix server, and started communicating with some of the "computer science" people, majors, a few really gave me a bad time, especially about my spelling.
Then one day I sent them a message, with proof, showing the code I used, "Hi guys, I don't need your permission to do anything any more, I just now gave myself administrator privileges, and can login as root, I can do anything I want to.", and I included the code I used to get root access. The response was , "Ok , OK, but please don't do it that way, we do have a way to do this that is best for every one ---snip--" The OP went on to explain to me more about how they preferred to do things, and why a "hack" was not such a good idea, they did start working with me, instead of against me,..also they started doing more work of their security settings, etc,... within a few days it was no longer that easy to get root access to the server, any way long story and years ago,about 40 years ago, geez, I am getting old.

kevinthefixer
Posts: 190
Joined: 2018-05-05 22:30

Re: How to use terminal of Linux?

#16 Post by kevinthefixer »

GarryRicketson wrote:geez, I am getting old.
I'll have you know I resemble that remark! Only thing I can count on in my body to work right these days are the aches & pains. The reason I've had time to be so active here this last week is that I just had a new cataract-free lens installed in my eye. Back to work tomorrow...

User avatar
None1975
df -h | participant
df -h | participant
Posts: 1387
Joined: 2015-11-29 18:23
Location: Russia, Kaliningrad
Has thanked: 45 times
Been thanked: 64 times

Re: How to use terminal of Linux?

#17 Post by None1975 »

Forgive me, but I will never understand the essence of this question. To create a new topic, ask a question when you can use Google services. Well, if you're a simple troll, then everything comes to its place.
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: How to use terminal of Linux?

#18 Post by debiman »

None1975 wrote:Forgive me, but I will never understand the essence of this question. To create a new topic, ask a question when you can use Google services. Well, if you're a simple troll, then everything comes to its place.
there's oh-too-many people who think that forums are just some form of "live google". it's not really trolling, just ignorance and a dose of egocentrism.
i don't mind the ignorance if it can be cured through gentle nudging towards search engine usage.
it also is a little difficult to separate the wheat from the chaff when you're new to all this.

i admit, the first post on this thread is way too vague ("i don't even really know myself what i am asking. can you help me?"), but op has asked clearer questions later on.

Post Reply