Day 12 - Linux and Git and github cheatsheet
Linux: Linux® is an open-source operating system (OS). An operating system is software that directly manages a system’s hardware and resources, like CPU, memory, and storage. The OS sits between applications and hardware and makes the connections between all of your software and the physical resources that do the work.
Linux commands:
ls - The most frequently used command in Linux to list directories
pwd - Print working directory command in Linux
cd - Linux command to navigate through directories
mkdir - Command used to create directories in Linux
mv - Move or rename files in Linux
cp - Similar usage as mv but for copying files in Linux
rm - Delete files or directories
touch - Create blank/empty files
cat - Display file contents on the terminal
clear - Clear the terminal display
echo - Print any text that follows the command
man - Access manual pages for all Linux commands
uname - Linux command to get basic information about the OS
whoami - Get the active username
tar - Command to extract and compress files in Linux
grep - Search for a string within an output
head - Return the specified number of lines from the top
tail - Return the specified number of lines from the bottom
diff - Find the difference between two files
cmp - Allows you to check if two files are identical
sort - Linux command to sort the content of a file while outputting
export - Export environment variables in Linux
zip - Zip files in Linux
unzip - Unzip files in Linux
ssh - Secure Shell command in Linux
service - Linux command to start and stop services
ps - Display active processes
kill and kill all - Kill active processes by process ID or name
df - Display disk filesystem information
mount - Mount file systems in Linux
chmod - Command to change file permissions
wget - Direct download files from the internet
sudo - Command to escalate privileges in Linux
cal - View a command-line calendar
top - View active processes live with their system usage
useradd and usermod - Add a new user or change existing users data
passwd - Create or update passwords for existing users
Git and GitHub:
Git is an open-source, version control tool created in 2005 by developers working on the Linux operating system.
GitHub is a company founded in 2008 that makes tools that integrate with git. You do not need GitHub to use git, but you cannot use GitHub without using git.
Git commands:
git init -- It is used for initializing a repository
git add file.js ---- it is used for staging a file
git status --- it is used to viewing the status
git commit -m "Message" -- It is used for committing the staged files
git rm file.js --- it is used to remove the file
git mv file1.js file1.txt --- It is used to move the files
git diff --- It is used to show the unstaged changes
git log --- to view full history
git log --online -- to get the summary
git config --global user. name ---- to give the user name
git config --global user.email --- to give the user mail
GitHub commands:
git clone [url] -- clone a remote git repository to your local machine
git fork --- Create a copy of a repository in your local machine
git remote add origin [url]: add a remote repository as the origin for the local repository.
git push -u origin [branch]: Push the local branch to the remote repository.
git pull-request: Create a pull request to suggest changes to a repository.
Thanks for reading,
Mohammed Muqafamuddin
Comments
Join the discussionNo comments yet. Be the first to comment.