LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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-13-2022, 03:18 AM   #1
complete
Member
 
Registered: Jul 2005
Location: St. Louis, USA
Posts: 38

Rep: Reputation: 15
Help needed to understand command line syntax.


I confess, I have been using GUI interfaces for a few decades. I have gotten used to Microsoft Windows Operating Systems and I have not spend enough time navagating all of the command line commands.... and this is especially true for Linux distributions like Ubuntu.

I DO know what 'cd ..' does when I type it on a Ubuntu command line as well as 'ls'. And I know where '../Directory' will take me. It goes up one level in the folder structure and then back down to where ever the 'Director' folder is. So, if the folder I am currently is is called 'RightHere', then the command line entry of '../RightHere' will seemingly take me no where.

But I never learned what a single dot means. For example, where is the folder 'interest' in the command 'gzip -d ./interest/dino-mod.tar.gz'.

Also, I do not know how '&&' is used. What would the following line do:

'cd ../engine && mkdir thirdparty'

It looks like two commands. So why are they on one line? Is it to make them execute at the same time? Is one command dependent on the other? Where would the directory 'thirdparty" be made?

All of these are examples of what (sort of) appears in a .sh file I need to execute. I need to know these details to ensure that the directory paths align and are accurate to where I will execute the .sh file.
 
Old 05-13-2022, 03:27 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,869

Rep: Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314
. means (in this context) current directory. see: https://en.wikipedia.org/wiki/Path_(computing) (look for relative path).
&& means "and", so cd ../engine && mkdir thirdparty means change dir into ../engine and make directory named thirdparty if that first command (cd) was successfully executed.
https://stackoverflow.com/questions/...-shell-command
 
1 members found this post helpful.
Old 05-13-2022, 03:32 AM   #3
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Quote:
Originally Posted by complete View Post

But I never learned what a single dot means. For example, where is the folder 'interest' in the command 'gzip -d ./interest/dino-mod.tar.gz'.
That means the current directory.
Quote:
Originally Posted by complete View Post
Also, I do not know how '&&' is used. What would the following line do:

'cd ../engine && mkdir thirdparty'

It looks like two commands. So why are they on one line? Is it to make them execute at the same time? Is one command dependent on the other? Where would the directory 'thirdparty" be made?
It is a logical "AND". It is kind of a trick to use it this way. When performing a logical "A AND B", if A is False, there is no attempt to evaluate B.

So, if the first command, "cd ../engine", completes without an error return code (return status is 0) then the second command, "mkdir thirdparty", will be run.
Quote:
Originally Posted by complete View Post
Where would the directory 'thirdparty" be made?
It would be "../engine/thirdparty".

HTH,

Evo2.
 
2 members found this post helpful.
  


Reply



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
From the command line What is the syntax syntax to import some data into mysql table Glenn D. Linux - Software 1 03-13-2015 09:26 AM
PHP Parse error: syntax error, unexpected end of file in Command line code on line 1 pizzipie Programming 8 12-11-2014 12:49 PM
httpd: Syntax error on line 210 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 iswarya Linux - Newbie 1 01-25-2012 01:28 PM
Starting httpd: httpd: Syntax error on line 209 of /etc/httpd/conf/httpd.conf: Syntax sethukpathi Linux - Networking 6 04-12-2008 11:26 AM
linux scripting help needed read from file line by line exc commands each line read atokad Programming 4 12-26-2003 10:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:38 AM.

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
Open Source Consulting | Domain Registration