20 basic linux commands for kids

learning linux commands has become a basic thing for everyone which helps in writing scripts,productivity and unlocking features that your GUI(graphical user interface) can’t offer. even you are not into software things learning these things will help you faster to navigate or work with files and directories or may be in future kids will use it for every pretty basic thing . so learn it!

why commands?

when computers first started out you can able to talk to it with only commands and programming language but to get computers accessible to everyone different company’s created different GUI’s which helps the consumers to do the specific task with out knowing any knowledge in programming. but now we the GEN-Z we grew with computers we don’t need a GUI to say what can and can’t do with our computer that’s where commands comes in and unlocks the setting of computer

1.whoami(Who-am-I)

“whoami ” is simple command which says user name of that pc

2.man

manual which is shortly referred as “man” it gives you reference manuals in these manual page there contains several sections like synopsis,description,options,return value etc.. even you an read the man command manual by using “man man” command. let’s say you know a command but you don’t know the use of it then you can simply use that command after the man and hit enter(“man” + command you don’t know) Try this: “man whoami” ↩ Result: you will get the manual page about “whoami” command

3.clear

“clear” is just clear which erases the previous command from your terminal and keep it clean for your next commands to type in. Use it when your terminal is filled with unnecessary previous commands.

4.pwd

“pwd” is used to know the current working directory.

5.ls

“ls” is used to list the files and directories in your current director. “la -a” will do the same thing but also show you hidden files (.files).

6.cd

“cd” will change the working directory of shell. “cd /” will take you to the root directory.

7.mkdir

“mkdir [file_name]” will create a directory if it does not already exist.

8.rmdir

“rmdir [file_name]” will remove a directory if they are empty.

9.touch

“touch [file_name]” will create a file in your directory , file name should have a extension. “touch test.txt” and “touch test1.html for text file and html.

10.rm

“rm [option] [file]” will remove the file. “rm [file_name]” removes the specified file from a directory. but you can also delete a entire directory which has files in it using the “-r” option.

11.mv

“mv” command is used to move a file from one dir to another or it can also be used to rename a file.

move a file:

to move a file from your current dir to another dir use the following syntax: mv [file_name] [dir_path] Ex: mv test.txt ../newdir/

rename a file:

to rename your file go to your dir where it present and use the below syntax : mv [current_file.extension] [new_file_name.extension] Ex: mv test1.text testOne.text

12.cp

with cp command you can copy your files or directories from one location to another.

syntax: cp [file_name] [destination] for files

cp [directory_path] [destination_directory_path] for directories.

Example : cp test_one.text ../test2/

13.head

“head [file_name]” Prints the first 10 lines of a file . pretty useful when you have large files and want to sneak peek into first few lines.

similarly we have a command called “cat” which is similar to head but it prints the entire contents of the file.

14.tail

converse to the head command we have tail which will print last 10 lines of the file. Syntax: “tail [file_name]” .

“less” is an another command which is useful when you want to read page by page of a large file .

15.date

“date” prints or set the system date and time.

16.echo

“echo” command is used to display string as output . it used in mainly in shell scripting to get the outcome status.

Syntax : echo “[your_text]”

17. redirecting the standard out put (> and >>)

If you want write files by appending or overwriting files you can use >> or > respectively.

syntax: echo “[text]” >> [file_name] will appends the text echo “[text]” > [file_name] will overwrite the previous text

18. wc and uniq

“wc” and “uniq” are two different commands. where “wc” is used to print the number of number of lines , word , characters in a give file respectively.

Syntax: wc [file_name.txt]

where as “uniq” will print the text which is in the given file but remove the adjacent duplicated lines.

Syntax: uniq [file_name]

19.sort

“sort” command will prints the lines of a file in order (alphabetically)

Syntax: sort [file_name.ext]

20.piping

pipe( | ) is used to combine two or more commands where first command output is acts as input for the next command for further processing.

for example if you want to sort and remove duplicate values of the file by using “uniq” command . you can do it with piping .

syntax: sort [file.text] | uniq