100% found this document useful (1 vote)
28 views12 pages

Linux Basics and Vim Commands Guide

This document provides a primer on Linux, including: 1. An overview of Linux fundamentals and why Linux is useful, particularly for servers. 2. A description of the Linux filesystem structure and how to view it using the "tree" command. 3. An introduction to common Linux commands like "ls", "find", "vim", "java", and how to configure environment variables and update Linux.

Uploaded by

Ashihs
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
28 views12 pages

Linux Basics and Vim Commands Guide

This document provides a primer on Linux, including: 1. An overview of Linux fundamentals and why Linux is useful, particularly for servers. 2. A description of the Linux filesystem structure and how to view it using the "tree" command. 3. An introduction to common Linux commands like "ls", "find", "vim", "java", and how to configure environment variables and update Linux.

Uploaded by

Ashihs
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Linux - A quick primer

- Abhay Dandekar
Agenda
1. Linux fundamentals
2. Why Linux?
3. Linux Filesystem structure
4. Vim editor
5. Linux commands
a. Environment variables
b. Filesystem commands
c. Service commands
d. Java
Linux Fundamentals
Good

1. Operating system
2. Server class
3. Stability over applications
4. Can be finetuned for application specific requirements

Not Good

1. Games
2. Documentation ( because of MS-Word monopoly)
Why we should use Linux
1. Most of the server environments are Linux
2. Built-in security in O.S design
3. Opensource, and hence more secure
4. Can be very easily modified for application specific requirements
5. Very good logs
6. ..
7. …
8. ….
9. …..
Linux Filesystem structure
Run the following command:

$ tree -L 1

This command will provide a view of filesystem in a tree format.

-L is the level, and we have provided 1, so it does not go into deeper file
structure.

Lets analyse the output of command.


Linux file permissions
RWX - Read / Write / Execute

drwxr-xr-x 2 adandekar adandekar 4096 Apr 4 10:28 Pictures


VIM : Editor
1. Modes ( Edit mode and command mode )
2. Search text
3. Execute command from vim
Linux Environment variables
● Similar to environment variables in Windows
● Important environment variables
○ PATH : bash searches for commands in PATH variable
■ PATH can be made persistent by using the following ways:
● Export : will export in current shell and all its children
● In .bashrc : .bashrc runs whenever a user profile is loaded. This will provide a user
specific exports. User needs to restart bash terminal to reflect the changes.
● In /etc/environment : This will export at a system level. Needs ssh / system reboot
to reflect the changes.
○ CLASSPATH : java searches for libraries and classes in CLASSPATH variable
Linux update
$ sudo yum upgrade
Linux commands
1. Ls 12. Chmod
2. Find 13. Chown
3. Vim 14.
4. Java
5. service
6. Systemctl
7. Ssh / ssh-copy-id
8. Ps
9. Tar / untar
10. Wget
11. Ip / ifconfig
Setup hostname
$ vi /etc/hostname

$ hostname

$ ip addr

Check your ip address

$ vi /etc/hosts

Ensure you setup the your hostname against your correct I.P
Passwordless ssh setup
$ ssh-keygen

$ ssh-copy-id <user>@<hostname>

$ ssh <user>@<hostname>

This might ask for a yes/no, but will bypass your password.

Common questions

Powered by AI

The Linux filesystem is structured hierarchically with a root directory and subdirectories organized for specific functions. The 'tree' command is used to display directories and files in a tree-like format. The '-L' option limits the depth of directories displayed; using '-L 1' will only show the top-level contents, providing a summary view without delving into nested directories . This can be particularly useful for quickly analyzing directory structures without overwhelming detail .

Passwordless SSH provides a secure and convenient method for authentication using SSH keys instead of passwords . Benefits include enhanced security since keys are less susceptible to brute force attacks compared to passwords, and convenience for automation scripts that require SSH access without manual password entry . However, its limitations include the initial setup complexity, as well as potential security risks if private keys are not properly secured or if server-side configurations are not managed adequately .

'systemctl' and 'service' are both used to manage services on Linux, but they differ in usage and functionality. 'systemctl' is a part of Systemd, a newer init system offering advanced tracking of service dependencies and states . It provides a unified interface to manage services across a Linux system. 'service', on the other hand, is a traditional command, part of the SysVinit model, providing basic start, stop, and restart functionalities . 'systemctl' is more comprehensive, offering detailed service control suitable for modern Linux environments .

Unix permissions, denoted as RWX (Read, Write, Execute), are critical for managing access control in Linux systems. Each file or directory is assigned permissions at the user, group, and others level, influencing who can read, modify, or execute the files . Proper configuration of these permissions ensures security by restricting unauthorized access and operations, crucial for maintaining data integrity and system security .

Linux is not ideal for gaming due to the lack of native support for many popular games, which often require a Windows environment for optimal performance and compatibility . Additionally, it struggles with extensive documentation tasks because of the dominance of proprietary software like MS Word; Linux alternatives may lack full compatibility with DOCX formats or similar advanced features .

Linux is preferred for server environments due to several key advantages: it is inherently secure due to its open-source nature, allowing for rapid identification and fixing of security vulnerabilities . It offers excellent stability over applications, thus providing a robust environment for servers . Additionally, Linux can be fine-tuned for application-specific requirements, allowing for optimized performance in various use cases .

Linux handles environment variables similarly to systems like Windows, but offers several ways to make them persistent which adds flexibility in system administration. Environment variables in Linux, such as PATH and CLASSPATH, can be permanently set by editing the .bashrc or /etc/environment files, which require a terminal restart or system reboot, respectively, for changes to take effect . This approach allows for both user-specific and system-wide configurations, crucial for managing consistent command behaviors across sessions or users .

Linux is considered more secure than proprietary operating systems primarily due to its open-source model, which allows for extensive peer review and quick patching of vulnerabilities . The built-in security features of Linux's design inherently protect against various types of attacks. Additionally, the ability to modify the system for specific application needs means security measures can be tailored more precisely .

Vim operates in several modes, primarily 'edit' mode and 'command' mode. Edit mode allows users to insert and modify text directly, whereas command mode is used for executing commands, navigating, and managing files . Effective use of these modes requires understanding the transitions between them—entering edit mode with 'i' and returning to command mode with 'Esc'—enabling efficient navigation and text manipulation within Vim .

Key Linux commands for system navigation and management include: 'ls' for listing directory contents; 'find' for searching files; 'vim' for text editing; 'chmod' and 'chown' for modifying permissions and ownership; 'service' and 'systemctl' for managing services; 'ssh' for secure remote logins; and 'tar' for archiving . These commands support a wide range of administrative tasks, from file management to service configuration, essential for efficient system operation .

You might also like