You are on page 1of 29

Terminal Commands part-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
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.
Command:- banner linux os
• 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.
Command:- banner “linux os”
??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????
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.


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.
Before sorting

• 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”
Press “Ctrl+d” after completing the • Then press enter key and you will see the
writing work results .
• You text will be sorted.

after sorting
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
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.
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.
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.
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.
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.
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 )
Step3:- before going in terminal first check the size of file.
(here its 12.3kb)

Step 4:- now open Terminal


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.
It will take some time.
• 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
• Now check the size of that file

We can see the size is now 4.6kb.


• 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
• 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
• 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.

You might also like