Terminal commands ubuntu 2

29
Terminal Commands part-2

Transcript of Terminal commands ubuntu 2

Page 1: Terminal commands ubuntu 2

Terminal Commands part-2

Page 2: Terminal commands ubuntu 2
Page 3: Terminal commands ubuntu 2

Command:- uname• It’s used to see system information.• We can use different command like

uname -a Print all information about system.

uname -s Print the kernel name

uname -n Print the network node hostname

uname -r Print kernel release

uname -v Print kernel version

uname –m Print the machine hardware name

uname -p Print the processor type

uname -i Print the hardware platform

uname-o Print the operating system

Page 4: Terminal commands ubuntu 2

Here we can see all the information of system

Page 5: Terminal commands ubuntu 2

Command:- banner TEXT

• For fancy text output we use command banner.• This command can be write in following manner– banner TEXT– banner “TEXT”• In text you can write what ever you want to write.

Page 6: Terminal commands ubuntu 2

Command:- banner linux os

Page 7: Terminal commands ubuntu 2

• When we write command:- banner linux os.• You can see output will be display in TWO line.

Because terminal will consider space between to words as line break.

• when we write command:- banner “linux os”.• You can see output will be display in single line.”_”

will consider as one line. What ever you write in this two quotes (“___”) it will be display in single line.

Page 8: Terminal commands ubuntu 2

Command:- banner “linux os”

Page 9: Terminal commands ubuntu 2

??Question??

• What happened here!!!!• We write all the TEXT between ( “___”) but still we don’t get desired output!!!!!• You can see here output is :- linux ubun • We did not get output like:- linux ubuntu.• WHY????

Page 10: Terminal commands ubuntu 2

In terminal with the help of banner ”__” command we can only get 10 characters in single line.

Command:- banner “linux ubuntu”

Here it will consider space between two word as a character.

So l =1,i=2,....,n will be 10th character.

So it will only display :- LINUX UBUN.

Page 11: Terminal commands ubuntu 2
Page 12: Terminal commands ubuntu 2

Command:- sort • sort sorts the contents of a text file, line by line.• sort is a simple and very useful command which will

rearrange the lines in a text file so that they are sorted, numerically and alphabetically.by default rules for sorting are:- lines starting with a number will appear before lines starting with a

letter; lines starting with a letter that appears earlier in the alphabet will

appear before lines starting with a letter that appears later in the alphabet;

lines starting with a lowercase letter will appear before lines starting with the same letter in uppercase.

Page 13: Terminal commands ubuntu 2

• Here you can see we write command :- sort and some text.

• After we complete the task of writing the words we have to press “Ctrl+d”

• Then press enter key and you will see the results .

• You text will be sorted.

Press “Ctrl+d” after completing the writing work

Before sorting

after sorting

Page 14: Terminal commands ubuntu 2

Command:- sort file_name

• As you can see here we apply sorting in existing file. Here we created one file name as games then we applied sorting on that file.

• Command :- sort file_name

Page 15: Terminal commands ubuntu 2

lower-case to upper-case

• Here we created one test file. We write some text in that file and then pressed “Ctrl+d”.• Now we can see all the thing that we written is in lower case now we want to convert that all

in upper case.

• Command:- dd if=existing_file_name of=output_file_name conv=ucase.• Here we created file name as a test and we want our output file name

as output so,• dd if=test of=output conv=ucase.

Page 16: Terminal commands ubuntu 2

upper-case to lower-case

• Here we created one file. We write some text in that file and then pressed “Ctrl+d”.• Now we can see all the thing that we written is in upper case now we want to convert that all

in lower case.

• Command:- dd if=existing_file_name of=output_file_name conv=lcase.• Here we created file name as a output and we want our utput file name

as input so,• dd if=output of=input conv=lcase.

Page 17: Terminal commands ubuntu 2

Command:- date

• This is very basic command.• It will display current date and time.• Command:- date• You can get more help for this command by typing:- date –help.

Page 18: Terminal commands ubuntu 2

Command:- cal

• This is also basic command.

• It will display current Calendar.

• Command:- cal• You can get more

help for this command by typing:- cal –help.

Page 19: Terminal commands ubuntu 2

Command:- cat existing file name >> new file with name

• If we want to make copy of existing file then we use this command.• Cat existing file name >> new file with name. Also we can use cp instead of cat.

• Here we created test1.• Now we want to copy that file then we have to use

• Cat test1 >> test2.• We can see test2 file with the help of command:- cat test2.

Page 20: Terminal commands ubuntu 2

Command:- compress

• For this we have to follow some steps.

Step 1:- Make a file name as test. Step2:- write some information in that file. (you can copy some text from Wikipedia )

Page 21: Terminal commands ubuntu 2

Step3:- before going in terminal first check the size of file.(here its 12.3kb)

Step 4:- now open Terminal

Page 22: Terminal commands ubuntu 2

Step 5:- write command:- compress –v file_name. (here compress –v test)

If you are using this command for first time then will give you error that you can see above.

Now we have to install some program.Just type:- sudo apt install ncompress. Then you have to enter the administration password.

Page 23: Terminal commands ubuntu 2

It will take some time.

Page 24: Terminal commands ubuntu 2

• Step 6:- now type command:-– compress –v file_name

Now go to that folder you will see your text file icon is now changed.

We can see icon of our test file now changed.Also it’s extension is also changed .z

Page 25: Terminal commands ubuntu 2

• Now check the size of that file

We can see the size is now 4.6kb.

Page 26: Terminal commands ubuntu 2

• Now back to terminal.• When we type cat test. It will give error no

such file or directory.• Now type command:- ls• You can see our file test is highlighted with red

color. Test.z • When we type cat test.z It will give error no

such file or directory

Page 27: Terminal commands ubuntu 2

• Command to see compressed file is zcat file_name.

• Here it’s zcat test.• You can see random text that I write in my file.• For uncompressing the file we have to type

command:- uncompress filename

Page 28: Terminal commands ubuntu 2

• As you can see before uncompressed file it’s color is RED• After typing command:-

• Uncompress filename ( uncompress test)

After uncompressing it’s color is changed to white.

For compressing file command:- compress –v filename.For uncompressing file command :- uncompress filename.

Page 29: Terminal commands ubuntu 2