Endsieg77's Studio.

Linux Learning Notes

2021/01/04 Share

Add some aliases for your commands

.bashrc is a file that stores the alias of command,
its content executed each time the shell is opened.
So we can add alias in the file by:

1
vim $HOME/.bashrc

Then, for example, if we wanna use the colored version of ls
without typing “—color” mechanically & repeatedly, add an
alias ls=”ls —color” at the end of the file.

Check your unwired lan driver

lspci is a command that lists all your PCI’s conditions.
We can check our drivers using grep and pipe:

1
lspci | grep -i ethernet

Task management

We can see the detailed information of our tasks
by command jobs -l and:
kill them using kill -KILL [pid],
stop them using kill -STOP [pid],
continue them kill -CONT [pid].
If we wanna terminate all our processes
kill -KILL -1

halt, shutdown, reboot

halt shuts down the system, but users still need to manually turn off the electricity.

shutdown requires parameters to function. It will both shut down the system and the electricity.

reboot restarts the system.

Both of them requires a root authentication.

Pass Parameters to your shell script

For example, if we wanna edit an existent text, and if the file doesn’t exist, the system shall create one, we can write a script named ‘’edit.sh”” as below:

1
2
3
4
5
6
7
name=$1
if [ -d /e/blog/source/_posts/${name} ]
then
echo "${name} does not exist\n"
hexo new ${name}
fi
vim /e/blog/source/_posts/${name}

then:

1
chmod 755 edit.sh

So can we call the edit.sh as if using a built-in command.

1
edit.sh "FOO"

Convert .deb into .tar

安装alien

1
2
3
4
5
6
# 从镜像站下载alien的rpm包
wget https://mirrors.aliyun.com/centos-vault/2.1/final/i386/CentOS/RPMS/alien-7.24-3.noarch.rpm
rpm -ivh alien-7.24-3.noarch.rpm
# 如果有rpm包安装有依赖,可以
# rpm -ivh *.rpm --nodeps --force
# --nodeps指忽略包依赖,--force指强制执行

使用alien

1
alien -r filename.deb generated
CATALOG
  1. 1. Add some aliases for your commands
  2. 2. Check your unwired lan driver
  3. 3. Task management
  4. 4. halt, shutdown, reboot
  5. 5. Pass Parameters to your shell script
  6. 6. Convert .deb into .tar
    1. 6.1. 安装alien
    2. 6.2. 使用alien