Sinisterly
Best Linux Guide And Command Explanation - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Computers (https://sinister.ly/Forum-Computers)
+--- Forum: Operating Systems (https://sinister.ly/Forum-Operating-Systems)
+--- Thread: Best Linux Guide And Command Explanation (/Thread-Best-Linux-Guide-And-Command-Explanation)

Pages: 1 2


Best Linux Guide And Command Explanation - dR.0xYw0Rm - 11-20-2013

S u p H C


Today I am going to explain you what is Linux and alot of useful Linux terminal commands.

If you still haven't decide which Linux distro to choose I would highly recommend you checking my guide:

* How To Choose The Right Linux Distribution For You *

[Image: GqXfDlL.png]

Linux is a Unix-like and POSIX-compliant computer operating system assembled under the model of free and open source software development and distribution. It is a freeware and generally speaking its free from Virus and other malware infections. The main form of distribution are Linux distributions. It's a bit harder to learn at first , a lot of command line stuff but when you get to grips with it it can be very rewarding.
The big thing about linux is that it is open source, which means there are virtually no license limitations so people can do what they want with it, this can be very useful for people who have very specific requirements and dont want to get involved in messy licensing as you would with windows for example.


[Image: vr4OpUJ.png]
Linux is multi platform.

This means that by choosing Linux, you choose a portable operating system on which you can run or develop portable applications. Linux runs on Sparc(Sun), Alpha(Compaq), Mips, ARM, x86(Intel), PowerPC, 680x0(Motorola), RS6000 (IBM), and so on... So,when choosing Linux for your operating system,you open choices to you. You don't reduce your choices to no­ otherc hoice­ than Intel running IBM compatible.

Linux is not under the control of NSA.

The NSA (NationalSecurityAgency,USA) and Microsoft recognized that two sets of secret keys where shipped with Windows in order to allow either Microsoft and NSA to enter any Windows running computer in the world Linux is open­ source. Anybody can check if there is such a back­door in it. NSA is working on a certificated secure version of the Linux kernel for USA use,because they know Windows is not secure.


[Image: yM7eivE.png]
Note: The commands below are top 5 in my opinion not officially.

"sudo"
Code:
sudo

Sudo best thought of as ‘Superuser Do’, allows you to run commands with root/administrator permissions.

For example: You can't do:

Code:
apt-get update

If you are not logged in as "root"

So all we have to do is to add "sudo" at the beginning of the command.

Code:
sudo apt-get update



"apt-get install"
Code:
apt-get install

Allows you to install applications available in the Ubuntu Software Center and added PPAs can be installed from the command line using ‘apt-get install‘.

I.E: (Installing tor on your machine)
Code:
apt-get install tor

"top"
Code:
top

Top command which is one of the most frequently used commands in our daily system administrative jobs. Top command displays processor activity of your Linux box and also displays tasks managed by kernel in real-time. It’ll show processor and memory are being used and other information like running processes. This may help you to take correct action. top command found in UNIX-like operating systems. You can perform different actions with that , even killing processes.


"cd"
Code:
cd
‘cd’ (Change Directory) is the command used for navigating folders in the Terminal.
‘cd folder/name/’ will navigate you into that folder
To go back on folder type
Code:
cd -
Typing ‘cd‘ on its own returns you to the ‘Home’ folder
Tip: Remember you can always use the ‘Tab’ button to auto-complete commands and locations in the Terminal.


"ls"
Code:
ls
ls command is one of the most frequently used command in Linux. I believe ls command is the first command you may use when you get into the command prompt of Linux Box. We use ls command daily basis and frequently even though we may not aware and never use all the option available. In this article, we’ll be discussing basic ls command where we have tried to cover as much parameters as possible.

[Image: LOHIUyr.png]
Show the current date and time
Code:
date

Show this month's calendar
Code:
cal


Show current uptime
Code:
uptime


Display who is online
Code:
w

Who you are logged in as
Code:
whoami


Display information about user
Code:
finger user


Show kernel information
Code:
uname -a

Cpu information
Code:
cat /proc/cpuinfo


Memory information
Code:
cat /proc/meminfo


Show disk usage
Code:
df


Show directory space usage
Code:
du


Show memory and swap usage
Code:
free



[Image: 45T540u.png]
Clear the terminal
Code:
CTRL L


Show content of file
Code:
cat <fileName>


Logout
Code:
CTRL D


Go up/down the terminal
Code:
SHIFT Page Up/Down


From the top
Code:
head


Cursor to start of line
Code:
CTRL A


Cursor the end of line
Code:
CTRL E


Delete left of the cursor
Code:
CTRL U


From the bottom
Code:
tail


Delete right of the cursor
Code:
CTRL K


Delete word on the left
Code:
CTRL W


Paste (after CTRL U,K or W)
Code:
CTRL Y


Create new folder
Code:
mkdir


Auto completion of file or command
Code:
TAB


Reverse search history
Code:
CTRL R


Repeat last command
Code:
!!




[Image: SC4TIGb.png]
List all files and folders <folderName> list files in folder
Code:
ls -a


Detailed list, Human readable
Code:
ls -lh


List jpeg files only
Code:
ls -l *.jpg


Result for file only
Code:
ls -lh <fileName>


Change directory if folder name has spaces use “ “
Code:
cd <folderName>


Go to root
Code:
cd /


Go up one folder, tip: ../../../
Code:
cd ..


Disk usage of folders, human readable
Code:
du -h


Only show disc usage of folders
Code:
du -sh


Print working directory
Code:
pwd


Shows manual (RTFM)
Code:
man <command>



[Image: nXxxvKt.png]
From the top
Code:
head


Sshow content of file
Code:
cat <fileName>


From the bottom -n <oflines> <fileName>
Code:
tail


Create new folder
Code:
mkdir


Copy image to folder
Code:
cp image.jpg <folderName>/


Copy and rename a folder
Code:
cp -R stuff otherStuff


Copy all of *<file type> to folder
Code:
cp *.txt stuff/


Move file to a folder
Code:
mv file.txt Documents/

Move folder in folder
Code:
mv <folderName> <folderName2>


Rename file
Code:
mv filename.txt filename2.txt


Move folder up in hierarchy
Code:
mv <folderName>/ ..


Delete file (s)
Code:
rm <fileName> ..


Ask for confirmation each file
Code:
rm -i <fileName> ..


Force deletion of a file
Code:
rm -f <fileName>


Delete folder
Code:
rm -r <foldername>/


Physical link
Code:
ln file1 file2


Symbolic link
Code:
ln -s file1 file2







[Image: 5SJoH6Z.png]
List manual pages for subject
Code:
apropos subject

Display man pages containing keyword
Code:
man -k keyword


Show the manual for command
Code:
man command


Make a pdf of a manual page
Code:
man -t man | ps2pdf - > man.pdf


Show full path name of command
Code:
which command


See how long a command takes
Code:
time command


Show possible locations of app
Code:
whereis app

Show which app will be run by default; it shows the full path
Code:
which app




[Image: 86wwtPY.png]
Search for pattern in files
Code:
grep pattern files


Search recursively for pattern in dir
Code:
grep -r pattern dir


Search for pattern in the output of command
Code:
command | grep pattern


Find all instances of file
Code:
locate file

Starting with the root directory, look for the file called filename
Code:
find / -name filename


Starting with the root directory, look for the file containing the string filename
Code:
find / -name ”*filename*” –


Find a file called filename using the locate command; this assumes you
have already used the command updatedb (see next)
Code:
locate filename


Create or update the database of files on all file systems attached to the Linux root directory
Code:
updatedb


Show the subdirectory containing the executable file called filename
Code:
which filename


Starting with the directory called dir, look for and list all files containing TextStringToFind
Code:
grep TextStringToFind /dir –




[Image: cF1wRfc.png]
Change the permissions of file to octal, which can be found separately for user, group, and world by adding: 4 – read ®, 2 – write (w), 1 – execute (x)
Examples:
chmod 777 – read, write, execute for all
chmod 755 – rwx for owner, rx for group and world
For more options, see man chmod.
Code:
chmod octal file


[Image: n08V9QD.png]
Connect to host as user
Code:
ssh user@host


Connect to host on port port as user
Code:
ssh -p port user@host


Add your key to host for user to enable a keyed or passwordless login
Code:
ssh-copy-id user@host


[Image: 7OxUKBL.png]
List IP addresses for all devices on the local machine
Code:
ifconfig


Ping host and output results
Code:
ping host


Get whois information for domain
Code:
whois domain

Get DNS information for domain
Code:
dig domain

Reverse lookup host
Code:
dig -x host

Download file
Code:
wget file

Continue a stopped download
Code:
wget -c file[/code+ [IMG]http://i.imgur.com/Ll6RIhq.png[/IMG] Create a new user call accountname [code]adduser accountname

Give accountname a new password
Code:
passwd accountname

Log in as superuser from current login
Code:
su

Stop being superuser and revert to normal user
Code:
exit


[Image: nJH0uAV.png]
Display your currently active processes
Code:
ps

Display all running processes
Code:
top

Kill process id pid
Code:
kill pid

Kill all processes named proc (use with extreme caution)
Code:
killall proc

Lists stopped or background jobs; resume a stopped job in the background
Code:
bg

Brings the most recent job to foreground
Code:
fg

Brings job n to the foreground
Code:
fg n


[Image: 19APdU5.png]
Installation from source
Code:
./configure make make install


install a DEB package (Debian / Ubuntu / Linux Mint)
Code:
dpkg -i pkg.deb


install a RPM package (Red Hat / Fedora)
Code:
rpm -Uvh pkg.rpm

(YUM) Yellowdog Updater Modified

Install the specified packages
Code:
yum install {package-name-1} {package-name-2} Install package called httpd: yum install httpd

Remove / Uninstall the specified packages
Remove package called httpd, enter:
Code:
yum remove {package-name-1} {package-name-2} yum remove httpd

Display the list of available packages
Code:
yum list all

Display list of group software
Code:
yum grouplist

Display list of updated software
Code:
yum list updates

List all installed packages
Code:
rpm -qa yum list installed

Find out if httpd package installed or not:
Code:
rpm -qa | grep httpd* yum list installed httpd

Check for and update specified package
Code:
yum update {package-name}

To check for and update httpd package
Code:
yum update httpd

Finding packages containing missing dependencies when installing software from source
Code:
yum whatprovides */<dependencyName>


Pacman


Lists all installed packages
Code:
pacman -Q

Install packages (from file)
Code:
pacman -U

Updates the list of packages and installs a given
package (from repository)
Code:
pacman -Sy

Update packages installed on your system with
the latest versions in the archives
Code:
pacman -Su

Updates the list of packages and upgrade
the packages installed on the system
Code:
pacman -Syu

Remove a package
Code:
pacman -Rc

Remove a package, delete the configuration
files and eliminates the dependencies
Code:
pacman -Rsn

Delete orphaned packages
Code:
pacman -Rs $(pacman -Qqtd)

Try searching within the package database
Code:
pacman -Ss

Show the detailed information on a given package
Code:
pacman -Si

Clear the system cache of video packets
Code:
pacman -Sc


[Image: 9nHYbDQ.png]
Shutdown the system now and do not reboot
Code:
shutdown -h now

Stop all processes - same as above
Code:
halt


Shutdown the system in 5 minutes and reboot
Code:
shutdown -r 5

Shutdown the system now and reboot
Code:
shutdown -r now

Stop all processes and then reboot - same as above
Code:
reboot

Start the X system
Code:
startx



I hope I learned something new to you. :>
Share it but don't forget to give credits.


- dR.0xYw0Rm aka Gaara



RE: ★★ BEST LINUX GUIDE AND COMMANDS EXPLANATION ★★ - tuxthepenguin - 11-21-2013

very good one for total newbies. i really like that you gave explanation on theadditional options on the subject.


RE: ★★ BEST LINUX GUIDE AND COMMANDS EXPLANATION ★★ - tuxthepenguin - 11-21-2013

very good one for total newbies. i really like that you gave explanation on theadditional options on the subject.


RE: ★★ BEST LINUX GUIDE AND COMMANDS EXPLANATION ★★ - Psycho_Coder - 11-21-2013

Excellent resources. You did a very good job and the thread is very well designed.


RE: ★★ BEST LINUX GUIDE AND COMMANDS EXPLANATION ★★ - Psycho_Coder - 11-21-2013

Excellent resources. You did a very good job and the thread is very well designed.


RE: ★★ BEST LINUX GUIDE AND COMMANDS EXPLANATION ★★ - chmod - 11-21-2013

This is good, however I have a couple of things to bring up, at the start of the guide you use apt-get for installing/updating software, as you know this is for Debian based systems and won't work under Redhat (yum) or arch (pacman) based systems.

One feature of the yum package manager which you missed is
Code:
yum whatprovides */<dependencyName>
Which is useful for finding packages containing missing dependencies when installing software from source

And again with startx, this presumes you are using xorg package to manage the windows, this is dependent upon the window manager the user is using, for example I use xfce which uses gdm3 instead.


RE: ★★ BEST LINUX GUIDE AND COMMANDS EXPLANATION ★★ - chmod - 11-21-2013

This is good, however I have a couple of things to bring up, at the start of the guide you use apt-get for installing/updating software, as you know this is for Debian based systems and won't work under Redhat (yum) or arch (pacman) based systems.

One feature of the yum package manager which you missed is
Code:
yum whatprovides */<dependencyName>
Which is useful for finding packages containing missing dependencies when installing software from source

And again with startx, this presumes you are using xorg package to manage the windows, this is dependent upon the window manager the user is using, for example I use xfce which uses gdm3 instead.


RE: ★★ BEST LINUX GUIDE AND COMMANDS EXPLANATION ★★ - Rohit123 - 11-21-2013

excellent but can I have any ebook like these tutorials...... how simple was explained. ...


RE: ★★ BEST LINUX GUIDE AND COMMANDS EXPLANATION ★★ - Rohit123 - 11-21-2013

excellent but can I have any ebook like these tutorials...... how simple was explained. ...


RE: ★★ BEST LINUX GUIDE AND COMMANDS EXPLANATION ★★ - Psycho_Coder - 11-21-2013

Will you please re-write the title using Title case. All caps looks awful.