All settings related to ubuntu, linux, OS
#1. Locate default ipython configuration folder
$ ipython profile locate
#2. Edit ipython_config.py file with magic commands
c.InteractiveShellApp.exec_lines = [
'%load_ext autoreload',
'%autoreload 2'
]
PROCESS STATE CODES 2 Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process:
D uninterruptible sleep (usually IO)
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped, either by a job control signal or because it is being traced
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct ("zombie") process, terminated but not reaped by its parent
For BSD formats and when the stat keyword is used, additional characters may be displayed:
< high-priority (not nice to other users)
N low-priority (nice to other users)
L has pages locked into memory (for real-time and custom IO)
s is a session leader
l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
+ is in the foreground process group
My explaination on how computer works at machine level:
------------------------------------------------------
Program Counter -----> --------------------------------------------------
-- ---- --
-- Address ---- Data --
-- ---- --
--------------------------------------------------
--------------------------------------------------
-- ---- --
-- Address ---- Data --
-- ---- --
--------------------------------------------------
--------------------------------------------------
-- ---- --
-- Address ---- Data --
-- ---- --
--------------------------------------------------
--------------------------------------------------
-- ---- --
-- Address ---- Data --
-- ---- --
--------------------------------------------------
Notes:
----------------
-- Data --
----------------
| \___________________
| |
| |
V v
--------------- ------------------------
- Instruction - or -- Value --
--------------- ------------------------
| |
| |
v v
------------- ----------------
-- Address -- --- Number ---
------------- ----------------
Example:
<MOV> <BYTE> <HIGH BYTE>
This instruction ins 8080 intel needs 3 byte only
Thought:
At the very low level, there must be some kind of mapping going on
For example, MOV is an opcode that must be recognized by the CPU hardware
Another example is Value can be mapped to ASCII sequence recognized by
the monitor so it can be printed. The process is reversed when we type on
a keyboard, as it translate from key to ASCII number
####################################
Beep does not work in Gnome-terminal
####################################
Since this is a very high rated question on google, I'll add the steps I did to re-enable beep in both console and X11:
- For the Linux Console (CTRL+ALT+F1...F6):
Why it does not work by default:
As already answered, the pcsprk kernel driver for the PC Speaker is blacklisted in Ubuntu.
Temporarily enable until reboot:
sudo modprobe pcsprk
Automatically enable on boot:
sudo nano /etc/modprobe.d/blacklist.conf -> uncomment #pcsprk line
- For X11 terminals (such as the default gnome-terminal):
Why it does not work by default:
Under X, like when using Unity, KDE, Gnome Shell, the beep events are captured by PulseAudio thanks to module-x11-bell, which is loaded by default at /usr/bin/start-pulseaudio-x11. And the sound sample PulseAudio plays on beep, bell.ogg, is blank by default. Additionally, the bell volume may be muted.
Temporarily enable for current session:
xset b 100 # perhaps not needed, on my system it was 40 by default
pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg
There are other suitable samples you can try at /usr/share/sounds, for example check the ones at /usr/share/sounds/gnome/default/alerts/
Note that the beep program is not really necessary. But if installed, it uses the PC Speaker. It was the only way I could find to enable the buzzer under X:
sudo apt-get install beep
Automatically enable on boot:
Just add the above lines in your ~/.profile, or system-wide at /etc/profile
- To test it:
printf '\a'
Beep!
beep
Buzz!
# Set intel backlight same value even after reboot the computer
vim /etc/rc.local
echo X > /sys/class/backlight/intel_backlight/brightness
# find file name ending with 'blah', without looking into /media folder
sudo find / -path /media -prune -o -name "*blah" -print
# grep something with no wrap by piping through pager with S option
grep ./ "Linux" -r | less -S
# Play with processes
ps aux # => show all process in the systems
ps -eLf # => show all process/threads (threads are called LWP in Ubuntu)
ps -Lf <pid> # => show process/thread of 1 process <pid>
pstree <pid> # => show all child processes/threads of process <pid>
ps -o pid,ppid,pgid,cmd,stat <pid1> <pid2> ... # => show info for <pid1>....
# Difference between && and ;;
command1 && command2 # => command1 finishes first successfuly, command2 will
#execute
command1; command2; # => command1 finishes first, doesn't matter success or
#not, command2 will execute
# Bracket is for subshell (child process)
(command1; command2)
# Login vs non-login, interactive vs non-interactive shell:
A session started as a login session will read configuration details from the /etc/profile file first. It will then look for the first login shell configuration file in the user's home directory to get user-specific configuration details.
It reads the first file that it can find out of ~/.bash_profile, ~/.bash_login, and ~/.profile and does not read any further files.
In contrast, a session defined as a non-login shell will read /etc/bash.bashrc and then the user-specific ~/.bashrc file to build its environment.
Non-interactive shells read the environmental variable called BASH_ENV and read the file specified to define the new environment.
# Nice trick with system sound
First find a sound you like (you can browse /usr/share/sounds for some available ones for example) and create a reference to it
export BEEP=/usr/share/sounds/KDE-Im-Message-In.ogg
Then have it available as a command
alias beep='paplay $BEEP'
Now just run beep whenever you need it. For example, to alert you when a command is finished:
find . | grep treasure ; beep