- $ echo : Used for displaying message
- example:
- $ echo "Hello, World!"
- output: Hello, World!
- “printf” command in Linux is used to display the given string, number or any other format specifier on the terminal window. It works the same way as “printf” works in programming languages like C.
- example
- Command:$printf "Hello World!"Output:
Hello World!
- date : the date command displays the current date and time, including the abbreviated day name, abbreviated month name, day of the month, the time separated by colons, the time zone name, and the year.
- example:
- Command:$dateOutput:Tue Oct 10 22:55:01 PDT 2017
- can be used with format specifiers:
- $date + %m : only month
- $date + %h : month name
- $date + %h%m : month name and month (eg. Aug 8)
- other specifiers:
- d : day of month (01 to 31)
- y : last two digits of year
- H M S : hr,min,sec
- D : date in format mm/dd/yy
- T : time in format hh:mm:ss
- passwd --- lets you change your password, which you should do regularly (at least once a year)
- Change your own password:
output:
$ passwdChanging password for ubuntu.(current) UNIX password:Enter new UNIX password:Retype new UNIX password:passwd: password updated successfully1. who : The ‘$ who’ command displays all the users who have logged into the system currently.As shown above on my system I am the only user currently logged in.The thing tty2 is terminal line the user is using and the next line gives the current date and time
$ whoOutput: harssh tty2 2017-07-18 09:32 (:0)2. pwd : The ‘$pwd’ command stands for ‘print working directory’ and as the name says,it displays the directory in which we are currently (directory is same as folder for Windows OS users).In the output we are harssh directory(folder for Windows OS that are moving to Linux),which is present inside the home directory$ pwdOutput: /home/harssh3. mkdir : The ‘$ mkdir’ stands for ‘make directory’ and it creates a new directory.We have used ‘$ cd’ (which is discussed below) to get into the newly created directory and again on giving ‘$ pwd’ command,we are displayed with the new ‘newfolder’ directory.
$ mkdir newfolder$ cd newfolderOutput: /home/harssh/newfolder$ pwd4. rmdir : The ‘$ rmdir’ command deletes any directory we want to delete and you can remember it by its names ‘rmdir’ which stands for ‘remove directory’.
$ rm dir newfolder
5. cd : The ‘$ cd’ command stands for ‘change directory’ and it changes your current directory to the ‘newfolder’ directory.You can understand this a double-clicking a folder and then you do some stuff in that folder.
$ cd newfolder (assuming that there is a directory named 'newfolder' on your system)
Post a Comment