Jump to content
Monitorize

Thread Options Understanding the Terminal and Linux Essentials (incomplete please add or post some if needed)

Recommended Posts

Everything On Linux Is a File.

Everything on Linux is a file, from your normal text documents, mp3's, documents, 
pictures, videos, to things like directories, disk drives, processes, and even network connections!
Linux just views everything as a stream of data, bits and bytes, 0's and 1's, the 
programs running on Linux, such as a text editor or a media player are what know 
how to handle the files that Linux views as just files.

Linux File Names.

You are allowed to use up to 255 characters plus a three letter file extension for a 
file name on Linux, which means you can be as descriptive as possible, but it is 
good to keep the file name under 80 characters because the average terminal is 
80 characters wide.
All file names in Linux are case-sensitive, meaning ilovelinux.txt, ILoveLinux.txt, 
and iLOvElInuX.txt are all completely different to linux, you could have all three of
those names as different files in the same directory. If you are using the terminal 
to specify a file you need to be sure that all the lower-case and upper-case letters 
are the same. Commands are all case-sensitive as well, the command rm won't
work if you type Rm or rM or RM, it will only work as rm.
Some special characters in Linux shouldn't be used when naming files, avoid using all of these characters \ / - [ ] * ? ' " 
and spaces just because they all cause problems when trying to access them via the terminal, 
if you do use them however you can use quotation marks while specifying the file 
via terminal eg: rm "doilovelinux*?.txt". Letters, underscores as long as it's
directly in between two letters, and numbers are always safe for file names.

Wildcards in Linux.

There are 3 different wildcards in linux, ? * and [ ] and I will go over what they do in a minute.
Lets say you have 12 pictures and 1 text file in one directory with the following names:
linux1.jpg
linux2.jpg
linux3.jpg
linux4.jpg
linux5.jpg
linux6.jpg
linux7.jpg
linux8.jpg
linux9.jpg
linux10.jpg
linux11.jpg
linux12.jpg
linux1.txt
and you want to delete them using the command rm. 
Wildcards allow you to specify more than one file at a time by matching characters.
The * wildcard will match any character 0 or more times, here are some examples:
rm linux1*.jpg will delete linux10-12.jpg as well as linux1.txt.
rm linux*.jpg will delete linux1-12.jpg but leave the .txt alone.
rm *txt will delete linux.txt but none of the .jpg.
rm linux* will delete all linux1-12.jpg and linux1.txt.
rm * will delete all files in the directory.

The ? wildcard will match a single character, here are some examples:
rm linux1?.jpg will delete linux10-12.jpg
rm linux?.jpg will delete linux1-9.jpg
rm linux?.* will delete linux1-9.jpg and linux1.txt

Lastly, the [ ] wildcard will match a set of single characters or a range of characters separated by a hyphen. Here are a few examples:
rm linux1[12].jpg will delete linux11.jpg and linux12.jpg but not linux10.jpg.
rm linux1[0-2].jpg will delete linux10.jpg, linux11.jpg, and linux12.jpg but not linux1.jpg.
rm linux[4-8].jpg will delete linux4.jpg through linux8.jpg.


The ls command

"ls" is one of the most commonly used commands. ls by itself just lists the contents of the directory you are currently in. Here are some examples:
ls /home/downloads
lists contents of /home/downloads

~ is equal to /home

ls ~/downloads
lists contents of /home/downloads

ls ~/downloads/*.exe
lists all .exe file types in the downloads folder

ls -R ~/downloads
lists all files in downloads and all of the files in its subfolders.

ls -1 ~/downloads 
(1=one, not l)
Organises the output in one column.

ls -m ~/downloads
Separates output with commas.

ls -a ~/downloads
View all of the hidden files and folders.

ls -F ~/downloads
View all of the contents file types.
* = executable
/ = directory
@ = symbolic link
| = FIFO
= = socket

ls --color
Displays a different color for each file type in the output.
Default shell color = regular file
Green = Executable
Blue = Directory
Magenta = Symbolic link
Yellow = FIFA

Share this post


Link to post
Share on other sites

You going to go over creating directories?

Share this post


Link to post
Share on other sites

this is a decent topic for starting to talk about linux.. although as you and I both know it goes deeper haha

Share this post


Link to post
Share on other sites

You going to go over creating directories?

 

Lol yes I'll add that to the post when I get home my bad i forgot about that

 

  

this is a decent topic for starting to talk about linux.. although as you and I both know it goes deeper haha

Lol oh ye

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×