19b85030b4
put some more programs and descriptions |
||
---|---|---|
README.md |
Important-Linux-commands
The commands which make life in cyberspace easier.
In the shell, you have to imagine the jumps. Because the computer will only be projecting code in your mind from your mind.
You are a specific point on some system, when you are in the shell. you can see what is in the directory you are with the command
ls
this command also can display other useful information. Of what is inside the directory you are in.
cd
The most important one. Instead to click, you change directories via command. that makes it possible to jump from one point to the other, especially with autocompletion.
man
In general you can get the manual entries for each of the programs described here and much more.
Just type
man cd
or type man ls
and you will get the manual opened historically with nano or less.. not sure, both good old editors.
cp
copy files from one place to another. (relatively from you)
cp /dirA/file1.py /dirB/file1.py
when there is already file1.py in the destination directory, it gets overwritten.
Concept of piping with >
in the shell you have standard input and standard output. Nothing more. to pipe the standard output from one program into a file, you write it like this:
ls > file.txt
When you write like that, youll overwrite everything in the file with the output.
If you want to append to a file what a program has as standard output, you can use >> instead. Writing it like this:
ls >> file.txt
This both is piping. There is another very important aspect of piping described later.
mkdir
another basic command. Create a new directory ("make dir")
su
stands for super user. use it to become super user. then the symbol in your shell changes from $ which means you are normal user to # which is the sysmbol of being superuser, or in other words: root.
sudo
this is a program you can put in front of commands, to get the superuser for only this command, typing your password of course. then for other x times writing sudo, you can issue commands as superuser without even typing in a password.
alias
give your complicated commands easy remember commands. Or build the own language of your shell.
alias cls=clear
This sets up an alias called cls. It will be another name for clear. When you type cls, it will clear the screen just as though you had typed clear.
On my Arch Linux, I can write these aliases in my bashrc config file. I need to issue the command
source bash_profile
to get the configuration loaded. On other linux there will be an analogon.
cat
print out what you have in front of you on the standard output.
also print several together
for instance:
cat doc1.txt doc2.txt > doc1ANDdoc2.txt
chown
On linux everything are only directories and (txt)files. All these objects have an owner, or also multiple ones.
sudo chown -R root /ole/ola/kp.txt
gives root the ownership of kp.txt
chmod
Every owner then has file permissions. That means he can read write or x (do) something. he can do all of them or some of them or none of them. Thats defined in codes, 777 gives them all and 660 doesnt completely.
sudo chmod 777 ole/oi/file.txt
bzw
sudo chmod 660 ole/oi/file.txt
Just look it up what people say regarding permissions and certain directories.
history
this lists all the commands of the shell you are in, that you have typed in lastly.
grep
if you have some bigger output of some of the former commands for example. Or whatever big output. then use grep to filter out the lines that have a certain word in it. GRAB it.
grep -lr word
is pretty cool. It searches you all the files recursively from your point in cyberspace - if they have in that "word". If yes, than the command will print out the file.
piping with |
here comes into account the piping with |.
Directly combining it with the history command is pretty effective..
history | grep "whatsoevercommandIalreadyfiguredoutbutreallydontwanttosearchoutagain"
here the output of history gets piped into the program grep. as the output of history gives one command per line, grep will filter out exactly the command in which the pattern "whatsoever" occur.
getting some INFO about the system
df
prints you out disc usage of your hardware
df -h
does it in humanreadable
du
prints out the size of files around you
du -h -d 2
prints in human readable with depth 2, that means in the directories and in their subdirectories.
lsblk
prints you out all the hardware devices with memory
htop respectively top
gives you a terminal graphics programm interface to see all running processes
tail -f
with tail or also head, you can print out the last or the first lines of a file
When you use tail -f, you get a stream of the documents last lines.
Thats perfect for some log files that get written.
journalctl -f
this gives you a stream of the kernel messages, which are pretty a lot about a lot of different topics of the programs on your machine.
The kernel is the ground software, running the hardware of the proper materia device. Its mostly in C. C is like the base of all languages. (if its not assembly)
uname (-a or -r or other)
gives you general infos about system, OS, and stuff
systemctl
some people do not like systemctl. I personally have parts of my structures that are managed by this software. with
sudo systemctl status nginx.service
I ask systemctl to give me the status of the nginx daemon, running in the background of my (and actually all of my machines there is running one nginx daemon) machine.
cool programs you find on almost all linux
ssh
with ssh, the secure shell, you can be on other computers worldwide connected to the internet. its basically the same thing as getting the standard shell programm of the system running the ssh daemon. but almost all systems do that as a standard
scp
thats copying from one computer to the other with the ssh protocol
rsync
better than scp because it can easily recover when something bad happens during the up or download of something big. from its syntax ssh alike.
vnc
is like ssh but for video
torify
the freedom of the internet is not a joke. with torify you can tunnel other programs over tor. with tor, with systemctl status/start/stop tor.service, with reading and writing the torrc (THE configuration file of tor) you can easily host a knot point or a bridge. Just understanding a lot about tor is already helping a lot for our freedom.
ncat
on linux OSes, or probably also on other computers, a lot of things are organised in so called ports.
ssh has port 22 http has port 80 https has port 443
a lot of these ports have different programs that use them. already over knowing these ports and their programs, you get to know GROUND computer stuff. OLD computer stuff. pretty strong stuff all coders kinda agreed and agree on.
with ncat, ports arent a problem anymore. just pip any port on any port (in the end, ports are also only directories, because there are only dirs and files on UNIX (kinda linux and apple together)).