How to create a command shortcut
Answer:
Sometimes, it is useful to set a command shortbut, by using the alias command
E.g.
# alias hello='echo world'
# hello
world
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to create a command shortcut
Answer:
Sometimes, it is useful to set a command shortbut, by using the alias command
E.g.
# alias hello='echo world'
# hello
world
How to set a shell variable
Answer:
Use the export command
# export foo=bar
# echo $foo
bar
Display current login user information
Answer:
To check your Linux username, use whoami
$ whoami
john
To see your User ID (UID), Group ID (GID) and who groups you belong to, use the command id
$ id
uid=1000(john) gid=100(users) groups=33(www-data),100(users)
Check how long server has been running
Answer:
Use the uptime command
$ uptime
22:36:10 up 12 min, 1 user, load average: 0.00, 0.04, 0.06
How to execute command in multiple lines
Answer:
The secret is the backslash \, put it at the end of the current line when you want to start a new line to continue the command.
E.g.
# echo "A" \
> "B" \
> "C"
A B C