Linux commands for beginners part 1
In this tutorial we will learn so many useful linux commands and this tutorial is basically based for newbie (newcomer). We have learnt few commands in previous tutorials (working with linux file contents). Here we will learn new linux commands are related to disk space, information about files or directories and kernel. Linux is case sensitive so whenever you are going to write a command with options and path then remember its upper and lower case sensitivity otherwise command will not work properly.
ls command is used for list the information about files and directories. Syntax is ls [option] dir-name.
Useful options are ls –l (show long form),
ls –t (show sort by time),
ls –lh (show long and human readable form),
ls –a (show list of all files with also hidden files which is represent by dot [.] ) which is showing in below image;
cd command is used for change the working directory or parent directory. Syntax is cd /path/dir-name.
Useful options are cd – (jump to old working directory),
cd or cd ~ (jump to home directory of login user),
cd.. (Jump to parent directory of current working directory),
cd../.. (Same as cd.. but jump two step back) as shown in below image;
file command is used to determine a file’s file type. Syntax file file-name.
uname command is used to show the kernel name and other information related to OS. Syntax uname [option]. Useful options are uname –o (show OS name),
uname –r (show kernel version),
uname –v (show kernel release),
uname –n (show hostname)
Now I am going to use echo command with redirectors. Redirectors is used to redirect data or contents in new file or given file and echo is used to create a file or print the string on screen.
Syntax echo string-to-print,
echo string-to-save > file-name, (> create new file or over write file if exist)
echo string-to-append >> file-name (>> append content in existing file).
stat command is used to check the status of file or directory. Syntax stat file-name. Here I created the testfile.txt to check/view the status and after that I made some modification in file to recheck the status.
Now we want to know how many lines, word and characters in file for this situation we use wc command. Syntax wc [option] file-name.
Useful options are wc –c (count characters of file),
wc –w (count words of file),
wc –l (count lines of file).
We want to information about boot time and user who are currently login by using who command. Syntax who [option].
Useful options are who –H (output with heading),
who –b (show the boot time),
who –r (show current runlevel).
whoami command is used to show current log on user on terminal. Syntax whoami.
cal command is used to display calendar. Syntax cal [option].
Useful options are cal –y (show the complete calendar),
cal –m (show the calendar start from Monday),
cal –j (show the Julian calendar),
cal -3 (show the previous, current and next month calendar).
I hope you will enjoy after practice these linux commands. In next tutorial I am going to explorer/share more linux commands with you guys keep in touch and learning with us.