Code Monkey home page Code Monkey logo

linux-commands's Introduction

Linux Commands

Updated everyday

whoami: Gives detail about the user login as.
whoami

man: Tells about the commands.
man <command name>

clear: Clear the terminal.
clear

pwd: Tells the location we currently in.
pwd

ls: List the content of a folder.
ls <file name>
ls -a: To explore all the files even hidden one's.
ls -l: To expand and see all the details of the file/folders like dates etc.
ls -al: To expand and show all the file/folders.

cd : To move from one to another file.
cd <file name>

mkdir: Makes a new directory.
mkdir fruit panda: will make two directories named as fruit and panda.
mkdir -p fruit/panda: make a nested directory.

rmdir: remove empty directory.
rmdir fruits cars: removing mutiple empty directory.

touch: to make some files.

rm: to remove files and folders.
rm -v : tell us what did it do.
rm -r: to remove directories.
rm -ri: interactively remove files.
rm -rf fruit car: delete folders with files in them.

open: open the directories.
open .: to open current directory.

mv: to move directory.
mv open open_pear: this command can change up file name from pear to open_pear.
mv open stuff: move from one directory to another.

cp: Copy files.
cp journel.txt new_jounel.txt: To make a copy in the same directory.
cp -r <filename>: to copy a directory.

head: Outputs the top 10 lines in a file.
head -n 100 file.txt : To print out the top 100 lines of the file.

tail: outputs the last 10 lines of a file.

>: to get the output of a command in a file.
pwd > today.txt: it saves the output in today.txt file, but this command just replaces the content of the file
Note: if the file does not exist in the directory, no problem it will create the file and store the output.
>>: If we use a double right arrow then the content in the file will be updated line by line.

cat: Concatinate
cat <filename>: this will print out the contents of the file.
cat <filename1> <filename2>: concatenate both the files and print out both file's contents.
cat file1 file2 file3 > fileEverything: It concatenates all the file's content into one file, here that is fileEverting.

less: Gives an interactive overview of the content saved inside the file.
less file: Gives an interactive vire of the content and we can search words also.

echo: Prints the txt file or text that is been provided.
echo hello: print hello
echo "hello" > anyfilename.txt: this command puts the hello command in a file called anyfilename.txt, if the file does not exist then it would make a file named after what we mentioned.

wc: Word Count. wc -l: No of lines
wc -w : No of words

Pipeping: ls -l | wc: This would count the no of lines, words that are been listed by ls -l.
cat file1.txt file2.txt | wc > wordcountfile.txt : It concatenates the content of file1 and file2 and gives a word count of it and stores the word count to a file name wordcountfile.txt..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.