here you will learn few new commands. commands like banner,sort,sort file,compress,uncompress,zcat command etc. you will learn how to compress file using terminal and also how to uncompress that file. you will learn how to print some FANCY TEXT etc.
Size: 2.31 MB
Language: en
Added: Jan 24, 2017
Slides: 29 pages
Slide Content
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
Here we can see all the information of system
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”
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????
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.
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
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
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, d d if=test of=output conv = ucase .
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 = l case . Here we created file name as a output and we want our utput file name as input so, d d if=output of=input conv = l case .
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.
This is also basic command. It will display current Calendar. Command:- cal You can get more help for this command by typing:- cal –help.
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.
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.