Linux Administration (15 Blogs) Become a Certified Professional
AWS Global Infrastructure
Introduction to Linux
  • Linux Tutorial: Everything You Need To Know To Get Started With Linux
  • 20 Linux Commands You'll Actually Use In Your Life
  • Unix vs Linux: Difference and Comparison
  • How to Install Ubuntu: The Complete Guide
  • How to Install Java/JDK on Ubuntu 18.04
  • Why do you need the different Linux Shells?
  • What is Linux Mint and how is it better than Ubuntu?
Linux Interview Questions
  • Top 50 Linux Interview Questions For Beginners In 2024
  • Your Complete Solution to Shell Scripting Interviews in 2024

Operating Systems

Topics Covered
  • Linux Administration (14 Blogs)
  • Linux Fundamentals (1 Blogs)
  • Comprehensive Unix Shell Scripting (1 Blogs)
SEE MORE

20 Linux Commands You’ll Actually Use In Your Life

Last updated on Mar 15,2023 60.4K Views
Share
image not found!WhatsApp image not found!Linkedin image not found!Twitter image not found!Facebook image not found!Reddit image not found!Copy Link!

Upasana

PHP网站源码惠州标王荷坳网页制作广州百度关键词包年推广横岗百搜标王坑梓seo排名塘坑网站设计模板坪地模板推广坑梓网站定制坪山关键词按天扣费大运网站推广方案布吉关键词按天扣费罗湖高端网站设计南山至尊标王南联网站推广工具爱联网络推广罗湖百度网站优化石岩关键词排名包年推广吉祥网站开发坑梓网页制作福永营销网站木棉湾百度网站优化排名双龙网站改版吉祥网站设计模板松岗网站优化横岗优化塘坑企业网站制作深圳网络营销塘坑网站推广宝安阿里店铺运营罗湖外贸网站建设歼20紧急升空逼退外机英媒称团队夜以继日筹划王妃复出草木蔓发 春山在望成都发生巨响 当地回应60岁老人炒菠菜未焯水致肾病恶化男子涉嫌走私被判11年却一天牢没坐劳斯莱斯右转逼停直行车网传落水者说“没让你救”系谣言广东通报13岁男孩性侵女童不予立案贵州小伙回应在美国卖三蹦子火了淀粉肠小王子日销售额涨超10倍有个姐真把千机伞做出来了近3万元金手镯仅含足金十克呼北高速交通事故已致14人死亡杨洋拄拐现身医院国产伟哥去年销售近13亿男子给前妻转账 现任妻子起诉要回新基金只募集到26元还是员工自购男孩疑遭霸凌 家长讨说法被踢出群充个话费竟沦为间接洗钱工具新的一天从800个哈欠开始单亲妈妈陷入热恋 14岁儿子报警#春分立蛋大挑战#中国投资客涌入日本东京买房两大学生合买彩票中奖一人不认账新加坡主帅:唯一目标击败中国队月嫂回应掌掴婴儿是在赶虫子19岁小伙救下5人后溺亡 多方发声清明节放假3天调休1天张家界的山上“长”满了韩国人?开封王婆为何火了主播靠辱骂母亲走红被批捕封号代拍被何赛飞拿着魔杖追着打阿根廷将发行1万与2万面值的纸币库克现身上海为江西彩礼“减负”的“试婚人”因自嘲式简历走红的教授更新简介殡仪馆花卉高于市场价3倍还重复用网友称在豆瓣酱里吃出老鼠头315晚会后胖东来又人满为患了网友建议重庆地铁不准乘客携带菜筐特朗普谈“凯特王妃P图照”罗斯否认插足凯特王妃婚姻青海通报栏杆断裂小学生跌落住进ICU恒大被罚41.75亿到底怎么缴湖南一县政协主席疑涉刑案被控制茶百道就改标签日期致歉王树国3次鞠躬告别西交大师生张立群任西安交通大学校长杨倩无缘巴黎奥运

PHP网站源码 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化

Upasana Research Analyst, Tech Enthusiast, Currently working on Azure IoT & Data Science... Research Analyst, Tech Enthusiast, Currently working on Azure IoT & Data Science with previous experience in Data Analytics & Business Intelligence.
  • Bookmark
image not found! image not found! image not found! image not found! image not found! image not found!Copy Link!
2 / 7 Blog from Introduction to Linux

Linux users and administrators can’t really live by the GUI alone. By only learning how to work with your tool, can you get the most out of Linux. Hence, we’ve brought together a list of useful Linux commands into this convenient guide, which will be of help no matter which Linux Curriculum you choose to learn from. 

So, I’ve categorized these commands into the following segments;

  • Linux Basic Commands 
  • Commands for Working with Files
  • Commands for Working with Directories
  • Commands for Working with User Permissions
  • Commands for Working with Zipped Files
  • Working with Secure Shell For Remote Machine Access

Linux Commands: Basic Commands 

Linux provides a CLI (Command Line Interface) to communicate with the OS. Here are the most basic of the Linux Commands.

1. pwd

This command Displays the current working directory of the terminal.

syntax:

$ pwd

pwd - linux commands - edureka2. echo

This command writes its arguments to standard output.

syntax:

$ echo "<text>"

echo - linux commands - edureka3. su

This command is used to switch to root-user so that superuser permissions can be used to execute commands.

syntax:

$ su

su - linux commands - edureka4. su <username>

This command is used to switch to a different user whose name is passed as the argument.

syntax:

$ su <username>

su user - linux commands - edureka5. sudo

This command executes only that command with root/ superuser privileges.

syntax:

$ sudo <command>

CommandExplanation
sudo useradd <username>

Adding a new user

sudo passwd <username>Setting a password for the new user
sudo userdel <username> Deleting the user
sudo groupadd <groupname>Adding a new group
sudo groupdel <groupname> Deleting the  group
sudo usermod -g <groupname> <username>Adding a user to a primary group

6. clear

This command is used to clear the terminal screen. Contents will not actually be deleted in this case, only scrolled down. You can also clear the screen by pressing Ctrl+L on the keyboard.

syntax:

$ clear

Linux Commands: Working with Files

7. cp 

This command copies files and directories. A copy of the file/directory copied, still remains in the working directory.

syntax:

$ cp <flag> {filename} /pathname/

cp - linux commands - edureka

CommandExplanation
cp -iEnters interactive mode; CLI asks before overwriting files
cp -nDoes not overwrite the file
cp -uUpdates the destination file only when the source file is different from the destination file
cp -RRecursive copy for copying directories; Copies even hidden files
cp -vVerbose; Prints informative messages

8. mv

This command moves files and directories from one directory to another. The file/directory once moved, is deleted from the working directory. 

syntax:

$ mv <flag> {filename} /pathname/

mv - linux commands - edureka

CommandExplanation
mv -iEnters interactive mode; CLI asks before overwriting files
mv -uUpdates the destination file only when the source file is different from the destination file
mv -vVerbose; Prints source and destination files

9. rm

This command removes files from a directory. By default, the rm command does not remove directories. Once removed, the contents of a file cannot be recovered.

syntax:

$ rm <flag> {filename} 

rm - linux commands - edureka

CommandExplanation
rm –rRemoves even non-empty directories.
rm –rpRemoves non-empty directories including parent and subdirectories.

10. grep

This command is used to search for a particular string/ word in a text file. This is similar to “Ctrl+F”, but executed via a CLI.

syntax:

$ grep <flag or element_to_search> {filename}

grep - linux commands - edureka

CommandExplanation
grep -iReturns the results for case insensitive strings
grep -nReturns the matching strings along with their line number
grep -vReturns the result of lines not matching the search string
grep -cReturns the number of lines in which the results matched the search string

Linux Commands | Edureka

This Edureka Live Session gives you an extensive explanation on the basic Linux commands so that you can start using the Linux CLI.

11. cat

This command can read, modify or concatenate text files. It also displays file contents.

syntax:

$ cat <flag> {filename}

cat - linux commands - edureka

CommandExplanation
cat -bThis is used to add line numbers to non-blank lines
cat -nThis is used to add line numbers to all lines
cat -sThis is used to squeeze blank lines into one line
cat –EShow $ at the end of line

Linux Commands: Working with Directories

12. ls

This command lists all the contents in the current working directory.

syntax:

$ ls <flag>
ls - linux commands - edureka

CommandExplanation
ls <path name>By specifying the path after ls, the content in that path will be displayed
ls –lUsing ‘l’ flag, lists all the contents along with its owner settings, permissions & time stamp (long format)
ls –aUsing ‘a’ flag, lists all the hidden contents in the specified directory
ls –authorUsing ‘–author’ flag, lists the contents in the specified directory along with its owner
ls –SUsing ‘a’ flag, sorts and lists all the contents in the specified directory by size
ls *.htmlUsing ‘*’ flag, lists only the contents in the directory of a particular format
ls –lS > file.txtUsing ‘>’ flag, copies the result of ls command into a text file

13. cd

This command is used to change the current working directory of the user.

syntax:

$ cd /pathname/

cd - linux commands - edureka

CommandExplanation
cd ~This command also changes the directory to home directory
cd /Changes the directory to root directory
cd ..Changes the directory to its parent directory
cd ‘xx yy’We specify the folder name in inverted commas because there is a space in the folder name

14. sort 

This command sorts the results of a search either alphabetically or numerically. Files, file contents and directories can be sorted using this command.

syntax:

$ sort <flag> {filename}

sort - linux commands - edureka

CommandExplanation
sort -rthe flag returns the results in reverse order;
sort -fthe flag does case insensitive sorting
sort -nthe flag returns the results as per numerical order

15. mkdir

This command is used to create a new directory.

syntax:

$ mkdir <flag> {directoryname} /pathname/

mkdir - linux commands - edureka

CommandExplanation
mkdir -pCreates both a new parent directory and a sub-directory
mkdir –p  <filename1>/{f1,f2,f3}This is used to create multiple subdirectories inside the new parent directory

16. rmdir

This command is used to remove a specified directory. Although by default, it can only remove an empty directory, there are flags which can be deployed to delete the non-empty directories as well.

syntax:

$ rmdir <flag> {directoryname} 

rmdir - linux commands - edureka

CommandExplanation
rmdir –pRemoves both the parent and child directory
rmdir –pvRemoves all the parent and subdirectories along with the verbose.

Linux Commands: Working with User Permissions

17. chmod

This command is used to change the access permissions of files and directories. Consider the example below.

chmod script - linux commands - edureka

On trying to run the newly created file named chmodtest.sh, an error is thrown. After modifying the permissions of the file using the said Linux command, it turns executable.

syntax:

$ chmod <permissions of user,group,others> {filename}

chmod - linux commands - edurekaThe permissions associated with each digit is as follows.

Numberreadwrite execute
0
1yes
2yes
3yesyes
4yes
5yesyes
6yesyes
7yesyesyes

 

Linux Commands: Installing Packages

Stable versions of most software’s will already be available in Linux repositories. Here are the Linux Commands to install them.

18. install packages

For an RHEL based system;

syntax:

$ sudo yum install package-name

For a Debian based system;

syntax:

$ sudo apt-get install package-name

For a Fedora based system;

syntax:

$ sudo dnf install package-name

Linux Commands: Working with Zipped Files

When you download a package from the internet, the downloaded file comes in compressed form. Here are a few commands to decompress and compress files in Linux.

19. tar

The following command is used to zip files of .tar format.

syntax:

$ tar –cvf tar-filename source-folder-name

The following command is used to unzip files of .tar format.

syntax:

$ tar –xvf tar-file-name

Linux Commands: Working with Secure Shell For Remote Machine Access

20. ssh

This command refers to a cryptographic network protocol for operating network services securely over an unsecured network. Typical use-cases include remote command-line execution, but any network service can be secured with SSH.

The following command, on running at the slave node, will give remote access to the master.

syntax:

$ ssh <master's ip>

The following command, on running at the master, will give remote access to the slave node.

syntax:

$ ssh <slave's ip>

So, there you have it. All the Linux commands you’re sure to use in your day-to-day IT-life.

Want to know more about the Commands in Linux? Edureka’s Linux Certification course is curated to shape your career as a Linux professional & help you to run applications, perform desired functions on your system and networks, create a network configuration, and maintain security administration.

Upcoming Batches For Linux Administration Certification Training Course
Course NameDateDetails
Linux Administration Certification Training Course

Class Starts on 21st September,2024

21st September

SAT&SUN (Weekend Batch)
View Details
Comments
0 Comments

Join the discussion Cancel reply

Browse Categories

Artificial Intelligence BI and Visualization Big Data Blockchain Business Management Cloud Computing Cyber Security Data Science Data Warehousing and ETL Databases DevOps Digital Marketing Enterprise Front End Web Development Human Resource Management Mobile Development Operations Management Product Management Programming & Frameworks Project Management and Methodologies Robotic Process Automation Software Testing Supply Chain Management Systems & Architecture
webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

20 Linux Commands You’ll Actually Use In Your Life

edureka.co

PHP网站源码惠州标王荷坳网页制作广州百度关键词包年推广横岗百搜标王坑梓seo排名塘坑网站设计模板坪地模板推广坑梓网站定制坪山关键词按天扣费大运网站推广方案布吉关键词按天扣费罗湖高端网站设计南山至尊标王南联网站推广工具爱联网络推广罗湖百度网站优化石岩关键词排名包年推广吉祥网站开发坑梓网页制作福永营销网站木棉湾百度网站优化排名双龙网站改版吉祥网站设计模板松岗网站优化横岗优化塘坑企业网站制作深圳网络营销塘坑网站推广宝安阿里店铺运营罗湖外贸网站建设歼20紧急升空逼退外机英媒称团队夜以继日筹划王妃复出草木蔓发 春山在望成都发生巨响 当地回应60岁老人炒菠菜未焯水致肾病恶化男子涉嫌走私被判11年却一天牢没坐劳斯莱斯右转逼停直行车网传落水者说“没让你救”系谣言广东通报13岁男孩性侵女童不予立案贵州小伙回应在美国卖三蹦子火了淀粉肠小王子日销售额涨超10倍有个姐真把千机伞做出来了近3万元金手镯仅含足金十克呼北高速交通事故已致14人死亡杨洋拄拐现身医院国产伟哥去年销售近13亿男子给前妻转账 现任妻子起诉要回新基金只募集到26元还是员工自购男孩疑遭霸凌 家长讨说法被踢出群充个话费竟沦为间接洗钱工具新的一天从800个哈欠开始单亲妈妈陷入热恋 14岁儿子报警#春分立蛋大挑战#中国投资客涌入日本东京买房两大学生合买彩票中奖一人不认账新加坡主帅:唯一目标击败中国队月嫂回应掌掴婴儿是在赶虫子19岁小伙救下5人后溺亡 多方发声清明节放假3天调休1天张家界的山上“长”满了韩国人?开封王婆为何火了主播靠辱骂母亲走红被批捕封号代拍被何赛飞拿着魔杖追着打阿根廷将发行1万与2万面值的纸币库克现身上海为江西彩礼“减负”的“试婚人”因自嘲式简历走红的教授更新简介殡仪馆花卉高于市场价3倍还重复用网友称在豆瓣酱里吃出老鼠头315晚会后胖东来又人满为患了网友建议重庆地铁不准乘客携带菜筐特朗普谈“凯特王妃P图照”罗斯否认插足凯特王妃婚姻青海通报栏杆断裂小学生跌落住进ICU恒大被罚41.75亿到底怎么缴湖南一县政协主席疑涉刑案被控制茶百道就改标签日期致歉王树国3次鞠躬告别西交大师生张立群任西安交通大学校长杨倩无缘巴黎奥运

PHP网站源码 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化