LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-23-2014, 11:06 AM   #1
John1
LQ Newbie
 
Registered: May 2014
Posts: 3

Rep: Reputation: Disabled
Unhappy Writing Commands




I assume there's an order to writing commands. What's first? How many spaces are necessary? Sorry, that's two questions. Thanks.
 
Old 05-23-2014, 12:05 PM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,185

Rep: Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587
What do you want to write commands in? Can you please provide more information, so we can figure out what you mean?
 
Old 05-23-2014, 12:51 PM   #3
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Are you talking about commands that you enter in a terminal? Or commands that you are including in a script or a program?
jdk
 
Old 05-23-2014, 01:05 PM   #4
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
John,
Both of the prior posters are exactly right. However, based on your question I think you'd like to tell us how to help you, you just don't understand how to ask the question.

The word your using, "command" is generic, it references shell built-in commands (what can be run in a terminal on your desktop) but it also references every other kind of command in every programming language that has ever been written as well. Take a moment and post more about what you want to do, don't worry if you don't know the right terminology, just try to describe it and you will find that most of the people here, including the two guys who answered this question before me, will be happy to help you get started.
 
Old 05-27-2014, 03:38 PM   #5
joe_2000
Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 823

Rep: Reputation: 237Reputation: 237Reputation: 237
Quote:
Originally Posted by John1 View Post

I assume there's an order to writing commands. What's first? How many spaces are necessary? Sorry, that's two questions. Thanks.
Assuming that you are talking about commands that you want to type into the terminal I could try to answer your questions rather generically:

The order of commands obviously depend on what you want to achieve. Say you want to rename a file that sits in directory /home/joe/my_directory from old_name to new_name.
You could go to that directory using cd and then rename the file using mv like so:
Code:
cd /home/joe/my_directory
mv old_name new_name
If you typed the commands in the reverse order it would not work. You'd be in the wrong directory while typing the mv command, so the file old_name could not be found, and hence not be renamed.

Typically the number of spaces between to words of a command do not matter, just one will do, but more won't hurt. The only exception are commands that refer to specific strings such as filenames, or commands that search for specific character sequences in text files or in the output of other commands.
E.g. there there is the ls command (ls standing for list), which lists directory content. To just list the files and directories in the current folder, you type
Code:
ls
Now, if you want more detailed output, you add a so-called command line option, the -l option (for long list)
Code:
ls -l
In the above line of code there is one space between ls and -l. However, the command would also work with two spaces:
Code:
ls  -l
Now, if you do not want to list contents of the current directory, but of a subdirectory called "my directory", you would have to type
Code:
ls 'my directory'
The directory name contains a space. Now if you typed
Code:
ls 'my   directory'
the command would fail, because the directory name was wrongly spelled.

Hope this helps a bit.
 
Old 05-27-2014, 03:53 PM   #6
marcelp1
Member
 
Registered: Nov 2010
Distribution: Debian
Posts: 35

Rep: Reputation: 1
Have a look at this brilliant and FREE book "The Debian Administrator's Handbook" from here:
http://debian-handbook.info/get/now/
that has got all you need for a start with commands and more.
 
Old 05-28-2014, 12:05 AM   #7
AREmbedded
LQ Newbie
 
Registered: May 2014
Posts: 3

Rep: Reputation: Disabled
You should first type the command name followed by a space and then any options particular to the command.
For example:-

"ls -l /home/user"
 
Old 05-28-2014, 03:52 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,357

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
Try http://rute.2038bug.com/index.html.gz
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Need help writing basic bash script to toggle two i8kctl commands (fan speed hi/low) Dennola4 Slackware 5 06-12-2011 10:33 AM
Writing Apps & Helpers for writers (all kinds) tech-writing, fiction, etc?? linus72 Debian 9 09-28-2009 09:34 AM
LXer: Writing simple python setup commands LXer Syndicated Linux News 0 04-10-2009 01:41 AM
Writing to tty causes writing to disk? (in ancient 2.2.x kernel) borsburn Linux - Kernel 0 12-17-2008 12:47 PM
Writing in commands in the console of several nodes at the same time Diego Torquemada Linux - General 1 01-02-2007 04:20 PM


All times are GMT -5. The time now is 08:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration